FFMPEG: extract images from video with fixed interval, first few frames messed up -
i wanted extract frames video fixed interval, used command lines like:
ffmpeg.exe -i input.mp4 -r 5 results\%d.jpg`
however, interval between first few frames different of rest.
for example, if both ffmpeg.exe -i input.mp4 -r 25 -t 5 test\%d.jpg
, ffmpeg.exe -i input.mp4 -r 5 -t 5 test2\%d.jpg
(for fps 25 video), expect results in test2
subsequence of results in test
interval 5. got are:
screenshot of results
from thumbnails, obvious images 112~125 in test
not appear in test2
. close inspection reveals correspondence between 2 set of results follows:
test | test2 1&2 | 1&2 (those 2 frames identical) 3 | 3 4 | 4 9 | 5 14 | 6 19 | 7 ... | ... 104 | 24 109 | 25
(actually, when comparing last frames, realized results in test
had mosaic. fixed adding option -q:v 1
.)
as can seen, first few frames test2
have interval 1, instead of expected value 5.
what reason behavior, , how fix it?
in case want see ffmpeg outputs:
ps c:\users\<username>\documents\new folder> ffmpeg.exe -i input.mp4 -r 25 -t 5 test\%d.jpg ffmpeg version n-50911-g9efcfbe copyright (c) 2000-2013 ffmpeg developers built on mar 13 2013 21:26:48 gcc 4.7.2 (gcc) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfi g --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg sm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --ena ble-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-lib twolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxa vs --enable-libxvid --enable-zlib libavutil 52. 19.100 / 52. 19.100 libavcodec 55. 0.100 / 55. 0.100 libavformat 55. 0.100 / 55. 0.100 libavdevice 54. 4.100 / 54. 4.100 libavfilter 3. 45.103 / 3. 45.103 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 input #0, mov,mp4,m4a,3gp,3g2,mj2, 'input.mp4': metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2015-05-05 04:46:16 duration: 00:49:04.96, start: 0.000000, bitrate: 386 kb/s stream #0:0(und): video: h264 (constrained baseline) (avc1 / 0x31637661), yuv420p, 524x360 [sar 1:1 dar 131:90], 287 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc metadata: handler_name : videohandler stream #0:1(und): audio: aac (mp4a / 0x6134706d), 44100 hz, stereo, fltp, 96 kb/s metadata: creation_time : 2015-05-05 04:46:21 handler_name : isomedia file produced google, 5-11-2011 output #0, image2, 'test\%d.jpg': metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 encoder : lavf55.0.100 stream #0:0(und): video: mjpeg, yuvj420p, 524x360 [sar 1:1 dar 131:90], q=2-31, 200 kb/s, 90k tbn, 25 tbc metadata: handler_name : videohandler stream mapping: stream #0:0 -> #0:0 (h264 -> mjpeg) press [q] stop, [?] frame= 125 fps=0.0 q=0.0 lsize=n/a time=00:00:05.00 bitrate=n/a video:1140kb audio:0kb subtitle:0 global headers:0kb muxing overhead -100.001884% ps c:\users\<username>\documents\new folder> ffmpeg.exe -i input.mp4 -r 5 -t 5 test2\%d.jpg ffmpeg version n-50911-g9efcfbe copyright (c) 2000-2013 ffmpeg developers built on mar 13 2013 21:26:48 gcc 4.7.2 (gcc) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfi g --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg sm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --ena ble-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-lib twolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxa vs --enable-libxvid --enable-zlib libavutil 52. 19.100 / 52. 19.100 libavcodec 55. 0.100 / 55. 0.100 libavformat 55. 0.100 / 55. 0.100 libavdevice 54. 4.100 / 54. 4.100 libavfilter 3. 45.103 / 3. 45.103 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 input #0, mov,mp4,m4a,3gp,3g2,mj2, 'input.mp4': metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2015-05-05 04:46:16 duration: 00:49:04.96, start: 0.000000, bitrate: 386 kb/s stream #0:0(und): video: h264 (constrained baseline) (avc1 / 0x31637661), yuv420p, 524x360 [sar 1:1 dar 131:90], 287 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc metadata: handler_name : videohandler stream #0:1(und): audio: aac (mp4a / 0x6134706d), 44100 hz, stereo, fltp, 96 kb/s metadata: creation_time : 2015-05-05 04:46:21 handler_name : isomedia file produced google, 5-11-2011 output #0, image2, 'test2\%d.jpg': metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 encoder : lavf55.0.100 stream #0:0(und): video: mjpeg, yuvj420p, 524x360 [sar 1:1 dar 131:90], q=2-31, 200 kb/s, 90k tbn, 5 tbc metadata: handler_name : videohandler stream mapping: stream #0:0 -> #0:0 (h264 -> mjpeg) press [q] stop, [?] frame= 25 fps=0.0 q=0.0 lsize=n/a time=00:00:05.00 bitrate=n/a dup=0 drop=88 video:375kb audio:0kb subtitle:0 global headers:0kb muxing overhead -100.005728%
Comments
Post a Comment