Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
FFMPEG global pattern multiple input formats
8 mars 2017, par Herman YanushI need to get thumbnails of all images in the directory. Images have formats
.png .jpg .JPG
.In order to do that I use
ffmpeg -pattern_type glob -i '*.jpg' -vf scale=320:-1 compressed/img%03d.png
When I use for it
*.jpg
and then for*.JPG
the first images are overwritten because numeration starts from zero again.I am looking for a way how to do a conversion for multiple formats or just for all files in the directory.
-
symbol lookup error with FFmpeg
8 mars 2017, par Tobias GeiselmannI am writing a Java application which uses FFmpeg. Therefore I use JNI to execute some native code. Compiling my shared object works without problems, but when I execute my code I get the following error:
/usr/local/jamaica-6.3-1/target/linux-x86_64/bin/jamaicavm_bin: symbol lookup error: /home/tobi/workspace/sender/lib/libsender.so: undefined symbol: av_frame_alloc
av_frame_alloc is a method of FFmpeg's libavutil library. I linked my shared object against a few FFmpeg libraries (such as libavcodec, libavutil, etc.), but I'm not able to execute methods from libavutil. When I run the nm command to list all the symbols from the object file, I get the following result:
tobi@tobi:~/workspace/sender/lib$ nm libsender.so U avcodec_alloc_context3@@LIBAVCODEC_54 U avcodec_copy_context@@LIBAVCODEC_54 U avcodec_find_decoder@@LIBAVCODEC_54 U avcodec_find_encoder@@LIBAVCODEC_54 U avcodec_open2@@LIBAVCODEC_54 U av_dump_format@@LIBAVFORMAT_54 U avformat_find_stream_info@@LIBAVFORMAT_54 U avformat_open_input@@LIBAVFORMAT_54 U av_frame_alloc U av_image_alloc@@LIBAVUTIL_52 U av_log@@LIBAVUTIL_52 U av_register_all@@LIBAVFORMAT_54
So, obviously, there is something wrong with av_frame_alloc. Why do I get a symbol lookup error every time I want to call av_frame_alloc?
Thanks!
-
What does "level" mean in FFprobe output ?
8 mars 2017, par shintaroidI do not understand some attributes in the output by
FFprobe
For a sample file
$ ffprobe -v error -show_format -show_streams input.mp4 [STREAM] index=0 codec_name=h264 codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 profile=High width=320 height=240 has_b_frames=2 pix_fmt=yuv420p level=13 <= This one! color_range=N/A
What does "level" mean here? Is there any document explain those attributes?
-
Does GeForce support GPU-accelerated video processing with FFmpeg ?
8 mars 2017, par shintaroidOn this page, it says "GeForce" is supported
HW accelerated encode and decode are supported on NVIDIA
GeForce
, Quadro, Tesla, and GRID products with Fermi, Kepler, Maxwell and Pascal generation GPUs.But I cannot find
GeForce
in the listed matrix on the same page. So doesGeForce
support or not? -
Getting realtime output from ffmpeg to be used in progress bar (PyQt4, stdout)
8 mars 2017, par Jason O'NeilI've looked at a number of questions but still can't quite figure this out. I'm using PyQt, and am hoping to run
ffmpeg -i file.mp4 file.avi
and get the output as it streams so I can create a progress bar.I've looked at these questions: Can ffmpeg show a progress bar? http://stackoverflow.com/questions/1606795/catching-stdout-in-realtime-from-subprocess
I'm able to see the output of a rsync command, using this code:
import subprocess, time, os, sys cmd = "rsync -vaz -P source/ dest/" p, line = True, 'start' p = subprocess.Popen(cmd, shell=True, bufsize=64, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE) for line in p.stdout: print("OUTPUT>>> " + str(line.rstrip())) p.stdout.flush()
But when I change the command to
ffmpeg -i file.mp4 file.avi
I receive no output. I'm guessing this has something to do with stdout / output buffering, but I'm stuck as to how to read the line that looks likeframe= 51 fps= 27 q=31.0 Lsize= 769kB time=2.04 bitrate=3092.8kbits/s
Which I could use to figure out progress.
Can someone show me an example of how to get this info from ffmpeg into python, with or without the use of PyQt (if possible)
EDIT: I ended up going with jlp's solution, my code looked like this:
#!/usr/bin/python import pexpect cmd = 'ffmpeg -i file.MTS file.avi' thread = pexpect.spawn(cmd) print "started %s" % cmd cpl = thread.compile_pattern_list([ pexpect.EOF, "frame= *\d+", '(.+)' ]) while True: i = thread.expect_list(cpl, timeout=None) if i == 0: # EOF print "the sub process exited" break elif i == 1: frame_number = thread.match.group(0) print frame_number thread.close elif i == 2: #unknown_line = thread.match.group(0) #print unknown_line pass
Which gives this output:
started ffmpeg -i file.MTS file.avi frame= 13 frame= 31 frame= 48 frame= 64 frame= 80 frame= 97 frame= 115 frame= 133 frame= 152 frame= 170 frame= 188 frame= 205 frame= 220 frame= 226 the sub process exited
Perfect!