[FFmpeg-user] frame extract is not accurate enough
Gergely Lukácsy
Gergely.Lukacsy at videosqr.com
Fri Jul 24 11:15:16 CEST 2015
Greetings, FFmpeg users!
I'm trying to OCR some presentation videos, using ffmpeg to extract frames. I need to figure out the exact locations of each transitions, and there's no other method to do that than inspecting the number of the output frame.
The command is the following:
/home/gergo/ffmpeg/ffmpeg-customvsq-git20150116-static/ffmpeg -i /tmp/presentation.mp4 -filter_complex 'scale=w=320:h=180:force_original_aspect_ratio=decrease' -r 1 -q:v 1 -f image2 /tmp/thumbnail/%06d.png -r 1 -q:v 1 -f image2 /tmp/full/%06d.jpg
As you can see, there's a 1 second framerate set for each output thread. (I'm splitting the output to get a full- and a thumbnail sized version.)
The strange thing that the total number of frames (300) produced is bigger than what the video duration (496 s) and the 1 sec framerate would indicate.
For example, there's a transition at 97 sec which occurs only at the 102nd frame. That's 4-5s latency in the first two minutes!
So, is there a method to increase the accuracy?
What causes this varying framerate?
Thanks in advance:
Gergely Lukácsy
------------------------
Here's the complete, uncut console output:
ffmpeg version N-69054-gc4f1abe-static Copyright (c) 2000-2015 the FFmpeg developers
built on Jan 16 2015 14:03:28 with gcc 4.7 (Debian 4.7.2-5)
configuration: --prefix=/home/gergo/buildscript/ffmpeg-static-master-customVSQ/target --extra-cflags='-I/home/gergo/buildscript/ffmpeg-static-master-customVSQ/target/include -static' --extra-cflags=--static --extra-ldflags='-L/home/gergo/buildscript/ffmpeg-static-master-customVSQ/target/lib -lm -static' --extra-libs=-ldl --extra-version=static --disable-debug --disable-shared --enable-static --extra-cflags=--static --disable-ffplay --disable-ffserver --disable-doc --enable-gpl --enable-pthreads --enable-postproc --enable-gray --enable-runtime-cpudetect --enable-libfaac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-bzlib --enable-zlib --enable-nonfree --enable-version3 --enable-libvpx --enable-libvo-aacenc --enable-librtmp
libavutil 54. 16.100 / 54. 16.100
libavcodec 56. 20.100 / 56. 20.100
libavformat 56. 18.101 / 56. 18.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 7.101 / 5. 7.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/presentation.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.0.100
Duration: 00:04:56.92, start: 0.000000, bitrate: 1480 kb/s
Stream #0:0(und): Video: h264 (High 4:2:2) (avc1 / 0x31637661), yuv422p, 1366x768, 1479 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
[swscaler @ 0x38885e0] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to '/tmp/thumbnail/%06d.png':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.18.101
Stream #0:0: Video: png, rgb24, 320x180, q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc (default)
Metadata:
encoder : Lavc56.20.100 png
Output #1, image2, to '/tmp/full/%06d.jpg':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.18.101
Stream #1:0(und): Video: mjpeg, yuvj422p(pc), 1366x768, q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc56.20.100 mjpeg
Stream mapping:
Stream #0:0 (h264) -> scale (graph 0)
scale (graph 0) -> Stream #0:0 (png)
Stream #0:0 -> #1:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
frame= 300 fps=3.0 q=0.0 Lq=0.0 size=N/A time=00:05:00.00 bitrate=N/A dup=0 drop=14246
video:72350kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
More information about the ffmpeg-user
mailing list