GithubHelp home page GithubHelp logo

zakgof / velvet-video Goto Github PK

View Code? Open in Web Editor NEW
47.0 3.0 10.0 390 KB

Java library for encoding / decoding / muxing / demuxing video and audio in various formats

License: Other

Java 100.00%
java video audio library muxing demuxing encoding decoding av1 vp9

velvet-video's People

Contributors

zakgof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

velvet-video's Issues

don't apply audio filter on mp3 file

don't work audio filter. example apply fade in and fade out

File src = new File("path");
`IVelvetVideoLib lib = VelvetVideoLib.getInstance();
IAudioDecoderStream audioStream = lib.demuxer(src).audioStreams().get(0);
AudioFormat format = audioStream.properties().format();

File output = new File(src.getParent(),filename);
IMuxerBuilder muxerBuilder = lib.muxer("mp3");

IAudioEncoderBuilder audioEncoderBuilder = lib.audioEncoder("libmp3lame", format).enableExperimental()
.filter("afade=t=in:st=0:d=15,afade=t=out:st=63:d=15");

IMuxer muxer = muxerBuilder.audioEncoder(audioEncoderBuilder).build(output);

IAudioEncoderStream audioEncoder = muxer.audioEncoder(0);

for (IAudioFrame audioFrame : audioStream) {
audioEncoder.encode(audioFrame.samples());
}`

Natives not re-extracted when using .free then .full natives

I'm attempting to play a mp4 file but I'm getting the following exception:

Apr 01, 2020 10:30:27 PM de.gurkenlabs.litiengine.configuration.Configuration load
INFO: Configuration config.properties loaded
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.
Apr 01, 2020 10:30:28 PM de.gurkenlabs.litiengine.DefaultUncaughtExceptionHandler uncaughtException
SEVERE: Game crashed! :(
com.zakgof.velvetvideo.VelvetVideoException: FFMPEG error -1094995529 : Invalid data found when processing input
        at com.zakgof.velvetvideo.impl.jnr.LibAVUtil.checkcode(LibAVUtil.java:101)
	at com.zakgof.velvetvideo.impl.VelvetVideoLib.checkcode(VelvetVideoLib.java:124)
	at com.zakgof.velvetvideo.impl.VelvetVideoLib.access$200(VelvetVideoLib.java:87)
	at com.zakgof.velvetvideo.impl.VelvetVideoLib$DemuxerImpl.<init>(VelvetVideoLib.java:818)
	at com.zakgof.velvetvideo.impl.VelvetVideoLib.demuxer(VelvetVideoLib.java:794)
	at com.zakgof.velvetvideo.IVelvetVideoLib.demuxer(IVelvetVideoLib.java:27)
	at de.gurkenlabs.litiengine.video.VideoPlayer$Demuxer.<init>(VideoPlayer.java:149)
	at de.gurkenlabs.litiengine.video.VideoPlayer.setVideo(VideoPlayer.java:37)
	at de.gurkenlabs.litiengine.video.VideoPlayer.<init>(VideoPlayer.java:30)
	at de.gurkenlabs.litiengine.video.VideoComponent.setVideo(VideoComponent.java:68)
	at de.gurkenlabs.litiengine.video.VideoComponent.setVideo(VideoComponent.java:50)
	at de.gurkenlabs.litiengine.video.VideoComponent.play(VideoComponent.java:54)
	at de.gurkenlabs.litiengine.video.VideoComponent.<init>(VideoComponent.java:28)
	at de.gurkenlabs.litiengine.resources.Videos.load(Videos.java:16)
	at com.gamebuster19901.Game.Main$VideoScreen.<init>(Main.java:37)
	at com.gamebuster19901.Game.Main.main(Main.java:32)

These are the video properties:

image

Demuxing internal sample goliath

[matroska,webm @ 00000000203337c0] Could not find codec parameters for stream 0 (Video: h264, none, 1920x1080): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options

Loading velvet-video-natives from jar only is supported

I'm using intelliJ and I've downloaded velvet-video-natives-0.2.8.full.jar. I've added it to my classpath with intelliJ but I'm getting the error: "Loading velvet-video-natives from jar only is supported". What's going on?

Encode/decode audio

Add api for encoding/decoding audio + include audio codec into native builds

Support MP4+flac

Getting error flac in MP4 support is experimental despite strict=-2 set

Can't find locale libs

I'm in trouble using velvet-video

Using maven dependencies 0.5.1 :
-Xms4000m
-Xmx4000m

        <additionalClasspathElement>/home/cabox/workspace/empty3/.velvet-video-natives/velvet-video-natives-0.5.1-SNAPSHOT.jar</additionalClasspathElement>
      </additionalClasspathElements>
            </configuration>
        </plugin>

(i ve tried relative and absolute path)

Put compilation of velvet-video natives into this folder.

How to pause a video playback!

I'm trying to make a video player using your demo project as a reference. Do you have an example of how you would implement a pause functionality?

crash on linux caused by loading wrong version of native libs

I've tried to play back some audio based on AudioPlayback example, and on linux (manjaro, though I doubt that matters) I got crash in libavutil:

[main] INFO velvet-video - Loading velvet-video-natives version 0.2.8.full
[main] DEBUG velvet-video - Velvet-video native extraction location is /home/<user>/.velvet-video/natives/0.2.8.full
[main] DEBUG velvet-video - Requesting loading native lib avutil.56
[main] DEBUG velvet-video - Checking native lib libavutil.so.56 at /home/<user>/.velvet-video/natives/0.2.8.full
[main] DEBUG velvet-video - Loaded libavutil.so.56
[main] DEBUG velvet-video - Requesting loading native lib swresample.3
[main] DEBUG velvet-video - Checking native lib libswresample.so.3 at /home/<user>/.velvet-video/natives/0.2.8.full
[main] DEBUG velvet-video - Loaded libswresample.so.3
[main] DEBUG velvet-video - Preloading native lib dependendcy: /home/<user>/.velvet-video/natives/0.2.8.full/libopenh264.so.5
[main] DEBUG velvet-video - Requesting loading native lib avcodec.58
[main] DEBUG velvet-video - Checking native lib libavcodec.so.58 at /home/<user>/.velvet-video/natives/0.2.8.full
[main] DEBUG velvet-video - Loaded libavcodec.so.58
[main] DEBUG velvet-video - Requesting loading native lib avformat.58
[main] DEBUG velvet-video - Checking native lib libavformat.so.58 at /home/<user>/.velvet-video/natives/0.2.8.full
[main] DEBUG velvet-video - Loaded libavformat.so.58
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f8aa2e7dc77, pid=55483, tid=55484
#
# JRE version: OpenJDK Runtime Environment (17.0.3+3) (build 17.0.3+3)
# Java VM: OpenJDK 64-Bit Server VM (17.0.3+3, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C  [libavutil.so.57.17.100+0x39c77]  av_opt_child_next+0x7
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (or dumping to /home/<user>/Documents/src/opus_decode_test/core.55483)
#
# An error report file with more information is saved as:
# /home/<user>/Documents/src/opus_decode_test/hs_err_pid55483.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
[1]    55483 IOT instruction (core dumped)

It seems like even though logs at the beginning say that libavutil.so.56 was loaded (from ~/.velvet-video), crash occured in libavutil.so.57.17.100. Looking at error report (hs_err_pid55483.log), it turns out that libavutil from my system was loaded: velvet is using /usr/lib/libavutil.so.57.17.100, /usr/lib/libswresample.so.4.3.100, /usr/lib/libavcodec.so.59.18.100 and /usr/lib/libavformat.so.59.16.100. Only lib that was actually loaded from ~/.velvet-video is libopenh264.so.5, which I don't have installed.

A weird thing from the error report is the fact that it seems like java tried to load the libs from ~/.velvet-video, but failed? Here are relevant lines:

Event: 0,606 Thread 0x00007f845c012630 Exception <a 'java/lang/UnsatisfiedLinkError'{0x0000000716640630}: avutil: cannot open shared object file: No such file or directory> (0x0000000716640630) 
thrown [src/hotspot/share/prims/jni.cpp, line 535]
Event: 0,672 Thread 0x00007f845c012630 Exception <a 'java/lang/NoSuchMethodError'{0x0000000716bd6d58}: 'java.lang.Object java.lang.invoke.DirectMethodHandle$Holder.newInvokeSpecial(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)'> (0x0000000716bd6d58) 
thrown [src/hotspot/share/interpreter/linkResolver.cpp, line 765]
Event: 0,741 Thread 0x00007f845c012630 Exception <a 'java/lang/UnsatisfiedLinkError'{0x00000007169ecc28}: /usr/lib64/libavutil.so.57.17.100: undefined symbol: av_frame_get_pkt_duration> (0x00000007169ecc28) 
thrown [src/hotspot/share/prims/jni.cpp, line 535]
Event: 0,754 Thread 0x00007f845c012630 Exception <a 'java/lang/UnsatisfiedLinkError'{0x0000000716674630}: swresample: cannot open shared object file: No such file or directory> (0x0000000716674630) 
thrown [src/hotspot/share/prims/jni.cpp, line 535]
Event: 0,795 Thread 0x00007f845c012630 Exception <a 'java/lang/UnsatisfiedLinkError'{0x0000000716b9a240}: avcodec: cannot open shared object file: No such file or directory> (0x0000000716b9a240) 
thrown [src/hotspot/share/prims/jni.cpp, line 535]
Event: 0,840 Thread 0x00007f845c012630 Exception <a 'java/lang/UnsatisfiedLinkError'{0x0000000715f04280}: /usr/lib64/libavcodec.so.59.18.100: undefined symbol: avcodec_open2x> (0x0000000715f04280) 
thrown [src/hotspot/share/prims/jni.cpp, line 535]
Event: 0,842 Thread 0x00007f845c012630 Exception <a 'java/lang/UnsatisfiedLinkError'{0x0000000715f21058}: /usr/lib64/libavcodec.so.59.18.100: undefined symbol: avcodec_register_all> (0x0000000715f21058) 
thrown [src/hotspot/share/prims/jni.cpp, line 535]
Event: 0,843 Thread 0x00007f845c012630 Exception <a 'java/lang/UnsatisfiedLinkError'{0x0000000715f2ad50}: /usr/lib64/libavcodec.so.59.18.100: undefined symbol: avcodec_encode_video2> (0x0000000715f2ad50) 
thrown [src/hotspot/share/prims/jni.cpp, line 535]
Event: 0,857 Thread 0x00007f845c012630 Exception <a 'java/lang/UnsatisfiedLinkError'{0x0000000715fb8e10}: avformat: cannot open shared object file: No such file or directory> (0x0000000715fb8e10) 
thrown [src/hotspot/share/prims/jni.cpp, line 535]

I'd look into it some more, but at the moment I have pretty much no idea how java is handling native libraries.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.