[FFmpeg-user] ffmpeg -i reports a video of length 03:17.53, but splitting into frames at 2 fps only results in one frame
Stéphane Chauveau
stephane at chauveau-central.net
Tue Jul 16 10:57:06 EEST 2019
In my previous comment, the change of framerate is done during the
transcoding to raw yuv which could be problematic with your mpeg
stream. An alternative could be to convert all frames to YUV and then
drop some of them during the second transcoding. Of course, the
intermediate raw file will be significantly larger so you may want to
use a pipe.
For example, the following command should keep 1 out of 25 frames:
ffmpeg -i video.mpg -s 640x480 -f rawvideo -c:v rawvideo -pix_fmt
yuv420p pipe: | ffmpeg -f rawvideo -framerate 25 -s 640x480
-pixel_format yuv420p -i pipe: -r 1 output/frame%06d.jpg
On 7/16/19 9:44 AM, Stéphane Chauveau wrote:
> I am no expert but something is obviously messing up with the frame
> number (a bug in ffmpeg?)
> So looking at your dump, it seems to me that the frames are produced
> correctly except that they all have the frame number 1.
> A solution to your problem could be to drop the frame information by
> transcoding to rawvideo and then to images.
>
> Something like that:
>
> ffmpeg -i video.mpg -r 1 -s 640x480 -c:v rawvideo -pix_fmt yuv420p
> out.yuv
> # ffplay -f rawvideo -framerate 1 -s 640x480 -pixel_format yuv420p -i
> out.yuv
> ffmpeg -f rawvideo -framerate 1 -s 640x480 -pixel_format yuv420p -i
> out.yuv 'output/frame_%06d.jpg'
>
>
> or using a pipe to avoid the intermediate raw file.
>
> ffmpeg -i video.mpg -r 1 -s 640x480 -f rawvideo -c:v rawvideo -pix_fmt
> yuv420p pipe: | ffmpeg -f rawvideo -framerate 1 -s 640x480
> -pixel_format yuv420p -i pipe: output/frame%06d.jpg
>
>
> On 7/15/19 8:07 PM, Griffin Smith wrote:
>> Hey all,
>> Hoping someone can help with this issue without me sharing the video
>> file,
>> since I unfortunately can't - I've got a few hundred video files I'm
>> working with that have an issue where ffmpeg -i reports them as having a
>> duration of a few minutes, but when I try to split them into frames,
>> I only
>> get one frame. The logs warn something about DTS discontinuity, but that
>> could be a red herring. Here's the raw output:
>>
>> $ ffmpeg -i video.mpg
>>
>> ffmpeg version n4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
>> built with gcc 8.2.1 (GCC) 20181127
>> configuration: --prefix=/usr --disable-debug --disable-static
>> --disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls
>> --enable-gpl --enable-ladspa --enable-libaom --enable-libass
>> --enable-libbluray --enable-libdrm --enable-libfreetype
>> --enable-libfribidi
>> --enable-libgsm --enable-libiec61883 --enable-libjack
>> --enable-libmodplug
>> --enable-libmp3lame --enable-libopencore_amrnb
>> --enable-libopencore_amrwb
>> --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr
>> --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2
>> --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp
>> --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2
>> --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx
>> --enable-shared
>> --enable-version3
>> libavutil 56. 22.100 / 56. 22.100
>> libavcodec 58. 35.100 / 58. 35.100
>> libavformat 58. 20.100 / 58. 20.100
>> libavdevice 58. 5.100 / 58. 5.100
>> libavfilter 7. 40.101 / 7. 40.101
>> libswscale 5. 3.100 / 5. 3.100
>> libswresample 3. 3.100 / 3. 3.100
>> libpostproc 55. 3.100 / 55. 3.100
>> [mpeg2video @ 0x56073afe6b00] Invalid frame dimensions 0x0.
>> Last message repeated 4 times
>> [mpeg @ 0x56073afe4c80] DTS discontinuity in stream 0: packet 7 with DTS
>> 62915937, packet 8 with DTS 8589979592
>> [mpeg @ 0x56073afe4c80] DTS discontinuity in stream 0: packet 22 with
>> DTS
>> 62960937, packet 23 with DTS 8590024592
>> [mpeg @ 0x56073afe4c80] DTS discontinuity in stream 0: packet 37 with
>> DTS
>> 63005937, packet 38 with DTS 8590069592
>> [mpeg @ 0x56073afe4c80] DTS discontinuity in stream 0: packet 52 with
>> DTS
>> 63050936, packet 53 with DTS 8590114591
>> [mpeg @ 0x56073afe4c80] DTS discontinuity in stream 0: packet 67 with
>> DTS
>> 63095936, packet 68 with DTS 8590159591
>> [mpeg @ 0x56073afe4c80] DTS discontinuity in stream 0: packet 82 with
>> DTS
>> 63140936, packet 83 with DTS 8590204591
>> [mpeg @ 0x56073afe4c80] DTS discontinuity in stream 0: packet 97 with
>> DTS
>> 63185936, packet 98 with DTS 8590249591
>> [mpeg @ 0x56073afe4c80] DTS discontinuity in stream 0: packet 112
>> with DTS
>> 63230936, packet 113 with DTS 8590294591
>> [mpeg @ 0x56073afe4c80] DTS discontinuity in stream 0: packet 127
>> with DTS
>> 63275936, packet 128 with DTS 8590339591
>> [mpeg @ 0x56073afe4c80] DTS discontinuity in stream 0: packet 142
>> with DTS
>> 63320936, packet 143 with DTS 8590384591
>> Input #0, mpeg, from 'video.mpg':
>> Duration: 00:03:17.53, start: 95444.217689, bitrate: 3602 kb/s
>> Stream #0:0[0x1e0]: Video: mpeg1video, yuv420p(tv), 720x480 [SAR
>> 1:1
>> DAR 3:2], 3600 kb/s, 30 fps, 30 tbr, 90k tbn, 30 tbc
>> At least one output file must be specified
>>
>> $ ffmpeg -i video.mpg -r 2 -s 640x480 'output/frame_%06d.jpg'
>>
>> ffmpeg version n4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
>> built with gcc 8.2.1 (GCC) 20181127
>> configuration: --prefix=/usr --disable-debug --disable-static
>> --disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls
>> --enable-gpl --enable-ladspa --enable-libaom --enable-libass
>> --enable-libbluray --enable-libdrm --enable-libfreetype
>> --enable-libfribidi
>> --enable-libgsm --enable-libiec61883 --enable-libjack
>> --enable-libmodplug
>> --enable-libmp3lame --enable-libopencore_amrnb
>> --enable-libopencore_amrwb
>> --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr
>> --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2
>> --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp
>> --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2
>> --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx
>> --enable-shared
>> --enable-version3
>> libavutil 56. 22.100 / 56. 22.100
>> libavcodec 58. 35.100 / 58. 35.100
>> libavformat 58. 20.100 / 58. 20.100
>> libavdevice 58. 5.100 / 58. 5.100
>> libavfilter 7. 40.101 / 7. 40.101
>> libswscale 5. 3.100 / 5. 3.100
>> libswresample 3. 3.100 / 3. 3.100
>> libpostproc 55. 3.100 / 55. 3.100
>> [mpeg2video @ 0x564a0be99c80] Invalid frame dimensions 0x0.
>> Last message repeated 4 times
>> [mpeg @ 0x564a0be97d80] DTS discontinuity in stream 0: packet 7 with DTS
>> 62915937, packet 8 with DTS 8589979592
>> [mpeg @ 0x564a0be97d80] DTS discontinuity in stream 0: packet 22 with
>> DTS
>> 62960937, packet 23 with DTS 8590024592
>> [mpeg @ 0x564a0be97d80] DTS discontinuity in stream 0: packet 37 with
>> DTS
>> 63005937, packet 38 with DTS 8590069592
>> [mpeg @ 0x564a0be97d80] DTS discontinuity in stream 0: packet 52 with
>> DTS
>> 63050936, packet 53 with DTS 8590114591
>> [mpeg @ 0x564a0be97d80] DTS discontinuity in stream 0: packet 67 with
>> DTS
>> 63095936, packet 68 with DTS 8590159591
>> [mpeg @ 0x564a0be97d80] DTS discontinuity in stream 0: packet 82 with
>> DTS
>> 63140936, packet 83 with DTS 8590204591
>> [mpeg @ 0x564a0be97d80] DTS discontinuity in stream 0: packet 97 with
>> DTS
>> 63185936, packet 98 with DTS 8590249591
>> [mpeg @ 0x564a0be97d80] DTS discontinuity in stream 0: packet 112
>> with DTS
>> 63230936, packet 113 with DTS 8590294591
>> [mpeg @ 0x564a0be97d80] DTS discontinuity in stream 0: packet 127
>> with DTS
>> 63275936, packet 128 with DTS 8590339591
>> [mpeg @ 0x564a0be97d80] DTS discontinuity in stream 0: packet 142
>> with DTS
>> 63320936, packet 143 with DTS 8590384591
>> Input #0, mpeg, from 'video.mpg':
>> Duration: 00:03:17.53, start: 95444.217689, bitrate: 3602 kb/s
>> Stream #0:0[0x1e0]: Video: mpeg1video, yuv420p(tv), 720x480 [SAR
>> 1:1
>> DAR 3:2], 3600 kb/s, 30 fps, 30 tbr, 90k tbn, 30 tbc
>> Stream mapping:
>> Stream #0:0 -> #0:0 (mpeg1video (native) -> mjpeg (native))
>> Press [q] to stop, [?] for help
>> [swscaler @ 0x564a0c06d640] deprecated pixel format used, make sure
>> you did
>> set range correctly
>> Output #0, image2, to 'output/frame_%06d.jpg':
>> Metadata:
>> encoder : Lavf58.20.100
>> Stream #0:0: Video: mjpeg, yuvj420p(pc), 640x480 [SAR 9:8 DAR 3:2],
>> q=2-31, 200 kb/s, 2 fps, 2 tbn, 2 tbc
>> Metadata:
>> encoder : Lavc58.35.100 mjpeg
>> Side data:
>> cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
>> frame= 1 fps=0.0 q=1.6 size=N/A time=26:19:06.00 bitrate=N/A dup=0
>> drop=513 speed=1.89e+05x
>> frame= 1 fps=1.0 q=1.6 size=N/A time=26:19:06.00 bitrate=N/A dup=0
>> drop=1017 speed=9.46e+04x
>> frame= 1 fps=0.7 q=1.6 size=N/A time=26:19:06.00 bitrate=N/A dup=0
>> drop=1521 speed=6.31e+04x
>> frame= 1 fps=0.5 q=1.6 size=N/A time=26:19:06.00 bitrate=N/A dup=0
>> drop=2022 speed=4.73e+04x
>> frame= 1 fps=0.4 q=1.6 size=N/A time=26:19:06.00 bitrate=N/A dup=0
>> drop=2523 speed=3.79e+04x
>> frame= 1 fps=0.3 q=1.6 size=N/A time=26:19:06.00 bitrate=N/A dup=0
>> drop=3020 speed=3.16e+04x
>> frame= 1 fps=0.3 q=1.6 size=N/A time=26:19:06.00 bitrate=N/A dup=0
>> drop=3528 speed=2.7e+04x
>> frame= 1 fps=0.2 q=1.6 size=N/A time=26:19:06.00 bitrate=N/A dup=0
>> drop=4032 speed=2.37e+04x
>> frame= 1 fps=0.2 q=1.6 size=N/A time=26:19:06.00 bitrate=N/A dup=0
>> drop=4525 speed=2.1e+04x
>> frame= 1 fps=0.2 q=1.6 size=N/A time=26:19:06.00 bitrate=N/A dup=0
>> drop=5029 speed=1.89e+04x
>> frame= 1 fps=0.2 q=1.6 size=N/A time=26:19:06.00 bitrate=N/A dup=0
>> drop=5528 speed=1.72e+04x
>> frame= 1 fps=0.2 q=1.6 Lsize=N/A time=26:19:06.00 bitrate=N/A dup=0
>> drop=5937 speed=1.6e+04x
>> video:29kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
>> muxing overhead: unknown
>>
>> $ ls output/
>>
>> frame_000001.jpg
>>
>> I'm really not super familiar with video transcoding or codecs at
>> all, so
>> I'm not sure where to go from here when troubleshooting this - let me
>> know
>> if this isn't something that's appropriate for this mailing list, and
>> I'm
>> happy to take it elsewhere - I may also be looking into hiring
>> consulting
>> services per https://ffmpeg.org/consulting.html
>>
>> Thanks,
>>
>> Griffin
>>
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list