[FFmpeg-trac] #6024(undetermined:new): avcodec_send_packet fails to decode mpeg2 correctly
FFmpeg
trac at avcodec.org
Thu Dec 15 06:26:40 EET 2016
#6024: avcodec_send_packet fails to decode mpeg2 correctly
-------------------------------------+-------------------------------------
Reporter: pkoshevoy | Owner:
Type: defect | Status: new
Priority: normal | Component:
Version: git- | undetermined
master | Keywords:
Blocked By: | avcodec_send_packet
Reproduced by developer: 0 | avcodec_send_packet flags truncated
| Blocking:
| Analyzed by developer: 0
-------------------------------------+-------------------------------------
Summary of the bug:
How to reproduce:
{{{
$ ./ffmpeg_g -flags truncated -i "http://samples.ffmpeg.org/MPEG2/test-
ebu-422.40000.pakets.ts" -c:v ffv1 -c:a copy -y /tmp/truncated.nut
ffmpeg version N-82861-ged412d2 Copyright (c) 2000-2016 the FFmpeg
developers
built with gcc 4.8 (SUSE Linux)
configuration: --prefix=/Developer/x86_64 --prefix=/Developer/x86_64
--enable-runtime-cpudetect --enable-libass --enable-libmodplug --enable-
shared --enable-pthreads --enable-gpl --enable-version3 --enable-gnutls
--enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-
debug=3 --disable-optimizations --disable-stripping --enable-pic
--disable-static --enable-shared --enable-rpath
libavutil 55. 43.100 / 55. 43.100
libavcodec 57. 68.100 / 57. 68.100
libavformat 57. 60.100 / 57. 60.100
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 68.100 / 6. 68.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
[mp3 @ 0x1b10680] Header missing
[mpeg2video @ 0x1b0f7a0] Invalid frame dimensions 0x0.
Last message repeated 3 times
[mpegts @ 0x1b09a40] PES packet size mismatch
Input #0, mpegts, from 'http://samples.ffmpeg.org/MPEG2/test-
ebu-422.40000.pakets.ts':
Duration: 00:00:06.53, start: 17163.308933, bitrate: 9217 kb/s
Stream #0:0[0x1062]: Video: mpeg2video (4:2:2), yuv422p(tv, top
first), 720x576 [SAR 16:15 DAR 4:3], 9000 kb/s, 25 fps, 25 tbr, 90k tbn,
50 tbc
Stream #0:1[0x1063]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s
Output #0, nut, to '/tmp/truncated.nut':
Metadata:
encoder : Lavf57.60.100
Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv422p, 720x576 [SAR
16:15 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 51200 tbn, 25 tbc
Metadata:
encoder : Lavc57.68.100 ffv1
Stream #0:1: Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16p,
384 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video (native) -> ffv1 (native))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0x1b09a40] PES packet size mismatchme=00:00:05.60
bitrate=28272.5kbits/s dup=0 drop=1 speed=1.31x
frame= 71 fps= 15 q=-0.0 Lsize= 22548kB time=00:00:06.32
bitrate=29226.9kbits/s dup=0 drop=2 speed=1.33x
video:22254kB audio:292kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.008866%
}}}
However, if you remove the `-flags truncated` parameter it decodes
correctly.
This was discovered while porting from deprecated `avcodec_decode_video2`
API to the new `avcodec_send_packet/avcodec_receive_frame` API. The new
avcodec_send_packet API specifies that the packet will be consumed
completely when it returns 0. However, that does not appear to be the
case when the decoder has the AV_CODEC_FLAG_TRUNCATED flag turned on.
Using the deprecated avcodec_decode_video2 API workflow the packet would
be resubmitted until all data is consumed, therefore the deprecated API
works correctly even when AV_CODEC_FLAG_TRUNCATED is turned on.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/6024>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list