Opened 12 years ago

Closed 11 years ago

#2386 closed defect (fixed)

ffmpeg creates non-PS3 compatible DivX

Reported by: someuser Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: libxvid regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Using the static win32 builds from zeranoe.com the DivX files created by the latest ffmpeg git version fail to play on PS3.

After testing old builds from zeranoe.com (see http://ffmpeg.zeranoe.com/builds/win32/static/) I have bisected the failure so that the build ffmpeg-git-b6ff81d-win32-static works ok (=PS3 can play the DivX) but ffmpeg-git-a4c22e3-win32-static and every build after that fail (=PS3 complains that the format is not supported).

Below are the commands I used with these two builds and as said only the former is playable with PS3. The notable change between the builds is libavutil update from 40.100 to 41.100.

How to reproduce:

> ./ffmpeg-git-b6ff81d-win32-static.exe -i test.avi -acodec libmp3lame -vcodec libxvid -level 5 -bf 2 -vtag XVID -map_metadata -1 out1.avi
ffmpeg version N-38148-gb6ff81d Copyright (c) 2000-2012 the FFmpeg developers
  built on Feb 23 2012 12:26:05 with gcc 4.6.2
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      51. 40.100 / 51. 40.100
  libavcodec     54.  4.100 / 54.  4.100
  libavformat    54.  1.100 / 54.  1.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 62.101 /  2. 62.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  7.100 /  0.  7.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, avi, from 'test.avi':
  Metadata:
    encoder         : Lavf54.59.106
  Duration: 00:00:10.03, start: 0.000000, bitrate: 1227 kb/s
    Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (DIVX / 0x58564944), yuv420p, 576x324 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 23.98 tbn, 2997 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16, 128 kb/s
[buffer @ 022EDAA0] w:576 h:324 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param:
Output #0, avi, to 'out1.avi':
  Metadata:
    ISFT            : Lavf54.1.100
    Stream #0:0: Video: mpeg4 (XVID / 0x44495658), yuv420p, 576x324 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 23.98 tbn, 23.98 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 -> libxvid)
  Stream #0:1 -> #0:1 (mp3 -> libmp3lame)
Press [q] to stop, [?] for help
frame=   22 fps=  0 q=4.0 size=      30kB time=00:00:00.91 bitrate= 268.5kbits/sframe=   37 fps=  0 q=9.0 size=      72kB time=00:00:01.54 bitrate= 379.8kbits/sframe=   47 fps= 31 q=17.0 size=     105kB time=00:00:01.94 bitrate= 443.9kbits/frame=   56 fps= 27 q=22.0 size=     125kB time=00:00:02.32 bitrate= 439.9kbits/frame=   65 fps= 25 q=19.0 size=     142kB time=00:00:02.68 bitrate= 433.5kbits/frame=   73 fps= 23 q=13.0 size=     158kB time=00:00:03.04 bitrate= 424.8kbits/frame=   80 fps= 22 q=19.0 size=     184kB time=00:00:03.33 bitrate= 451.2kbits/frame=   90 fps= 22 q=26.0 size=     227kB time=00:00:03.74 bitrate= 495.6kbits/frame=  100 fps= 21 q=29.0 size=     263kB time=00:00:04.15 bitrate= 518.9kbits/frame=  110 fps= 21 q=31.0 size=     297kB time=00:00:04.58 bitrate= 529.9kbits/frame=  121 fps= 21 q=31.0 size=     331kB time=00:00:05.04 bitrate= 537.3kbits/frame=  131 fps= 21 q=31.0 size=     356kB time=00:00:05.44 bitrate= 535.1kbits/frame=  141 fps= 21 q=31.0 size=     381kB time=00:00:05.88 bitrate= 530.4kbits/frame=  151 fps= 21 q=31.0 size=     404kB time=00:00:06.28 bitrate= 526.6kbits/frame=  160 fps= 21 q=31.0 size=     430kB time=00:00:06.67 bitrate= 528.4kbits/frame=  168 fps= 20 q=31.0 size=     444kB time=00:00:06.98 bitrate= 520.7kbits/frame=  178 fps= 20 q=31.0 size=     467kB time=00:00:07.41 bitrate= 515.6kbits/frame=  187 fps= 20 q=31.0 size=     485kB time=00:00:07.79 bitrate= 509.5kbits/frame=  196 fps= 20 q=31.0 size=     504kB time=00:00:08.16 bitrate= 506.5kbits/frame=  206 fps= 20 q=31.0 size=     517kB time=00:00:08.56 bitrate= 494.8kbits/frame=  216 fps= 20 q=31.0 size=     536kB time=00:00:09.00 bitrate= 487.5kbits/frame=  226 fps= 20 q=31.0 size=     550kB time=00:00:09.40 bitrate= 479.3kbits/frame=  238 fps= 20 q=31.0 size=     568kB time=00:00:09.91 bitrate= 469.7kbits/frame=  240 fps= 20 q=31.0 Lsize=     582kB time=00:00:10.01 bitrate= 476.4kbits/s
video:400kB audio:157kB global headers:0kB muxing overhead 4.555188%
> ./ffmpeg-git-a4c22e3-win32-static.exe -i test.avi -acodec libmp3lame -vcodec libxvid -level 5 -bf 2 -vtag XVID -map_metadata -1 out2.avi
ffmpeg version N-38292-ga4c22e3 Copyright (c) 2000-2012 the FFmpeg developers
  built on Feb 27 2012 14:50:39 with gcc 4.6.2
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      51. 41.100 / 51. 41.100
  libavcodec     54.  4.100 / 54.  4.100
  libavformat    54.  1.100 / 54.  1.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 62.101 /  2. 62.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  7.100 /  0.  7.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, avi, from 'test.avi':
  Metadata:
    encoder         : Lavf54.59.106
  Duration: 00:00:10.03, start: 0.000000, bitrate: 1227 kb/s
    Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (DIVX / 0x58564944), yuv420p, 576x324 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 23.98 tbn, 2997 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16, 128 kb/s
[buffer @ 022FDAA0] w:576 h:324 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param:
Output #0, avi, to 'out2.avi':
  Metadata:
    ISFT            : Lavf54.1.100
    Stream #0:0: Video: mpeg4 (XVID / 0x44495658), yuv420p, 576x324 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 23.98 tbn, 23.98 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 -> libxvid)
  Stream #0:1 -> #0:1 (mp3 -> libmp3lame)
Press [q] to stop, [?] for help
frame=   31 fps=  0 q=3.0 size=      39kB time=00:00:01.27 bitrate= 250.3kbits/sframe=   41 fps= 39 q=14.0 size=      84kB time=00:00:01.70 bitrate= 403.2kbits/frame=   50 fps= 31 q=23.0 size=     112kB time=00:00:02.06 bitrate= 442.6kbits/frame=   59 fps= 28 q=17.0 size=     127kB time=00:00:02.42 bitrate= 429.0kbits/frame=   67 fps= 26 q=18.0 size=     144kB time=00:00:02.78 bitrate= 424.8kbits/frame=   76 fps= 24 q=18.0 size=     167kB time=00:00:03.16 bitrate= 431.9kbits/frame=   85 fps= 23 q=20.0 size=     199kB time=00:00:03.52 bitrate= 461.5kbits/frame=   95 fps= 22 q=28.0 size=     244kB time=00:00:03.96 bitrate= 504.2kbits/frame=  105 fps= 22 q=30.0 size=     280kB time=00:00:04.36 bitrate= 524.9kbits/frame=  116 fps= 22 q=31.0 size=     315kB time=00:00:04.82 bitrate= 534.1kbits/frame=  127 fps= 21 q=31.0 size=     346kB time=00:00:05.28 bitrate= 536.3kbits/frame=  139 fps= 22 q=31.0 size=     374kB time=00:00:05.78 bitrate= 529.2kbits/frame=  148 fps= 21 q=31.0 size=     396kB time=00:00:06.16 bitrate= 526.6kbits/frame=  159 fps= 21 q=31.0 size=     423kB time=00:00:06.62 bitrate= 523.1kbits/frame=  166 fps= 21 q=31.0 size=     440kB time=00:00:06.91 bitrate= 521.6kbits/frame=  176 fps= 20 q=31.0 size=     461kB time=00:00:07.32 bitrate= 516.0kbits/frame=  186 fps= 20 q=31.0 size=     483kB time=00:00:07.75 bitrate= 509.9kbits/frame=  196 fps= 20 q=31.0 size=     503kB time=00:00:08.16 bitrate= 505.3kbits/frame=  206 fps= 20 q=31.0 size=     517kB time=00:00:08.56 bitrate= 494.8kbits/frame=  216 fps= 20 q=31.0 size=     535kB time=00:00:09.00 bitrate= 486.7kbits/frame=  226 fps= 20 q=31.0 size=     550kB time=00:00:09.40 bitrate= 479.3kbits/frame=  238 fps= 20 q=31.0 size=     568kB time=00:00:09.91 bitrate= 469.3kbits/frame=  240 fps= 20 q=31.0 Lsize=     582kB time=00:00:10.05 bitrate= 474.5kbits/s
video:400kB audio:157kB global headers:0kB muxing overhead 4.559397%
> 

It should be noted that the following still works with current git (=the output file is playable with PS3):

./ffmpeg-git-17c1881-win32-static.exe -i test.avi -acodec libmp3lame -vcodec mpeg4 -level 5 -bf 2 -vtag XVID -map_metadata -1 out3.avi

Attachments (4)

32e7439.avi (582.4 KB ) - added by Carl Eugen Hoyos 12 years ago.
e2cc39b.avi (582.4 KB ) - added by Carl Eugen Hoyos 12 years ago.
e2cc39b-patched.avi (582.4 KB ) - added by Carl Eugen Hoyos 11 years ago.
5a65fea-patched.avi (582.4 KB ) - added by Carl Eugen Hoyos 11 years ago.

Change History (14)

comment:1 by Michael Niedermayer, 12 years ago

There are 144 commits between b6ff81d and a4c22e3. Can you find out which exact commit causes the regression ?

comment:2 by Carl Eugen Hoyos, 12 years ago

If you can provide the input video, I will try to find out which change broke ps3 encoding.

in reply to:  2 comment:3 by someuser, 12 years ago

Replying to cehoyos:

If you can provide the input video, I will try to find out which change broke ps3 encoding.

Seems that it happens with more or less with any input video - but the one I just used to reproduce is attached to ticket 2385:

https://ffmpeg.org/trac/ffmpeg/attachment/ticket/2385/testxsub-ok.avi

Thanks!

by Carl Eugen Hoyos, 12 years ago

Attachment: 32e7439.avi added

by Carl Eugen Hoyos, 12 years ago

Attachment: e2cc39b.avi added

comment:4 by Carl Eugen Hoyos, 12 years ago

Component: undeterminedavcodec
Keywords: libxvid regression added
Priority: normalimportant

Could you confirm that 32e7439.avi plays fine while e2cc39b.avi fails?
(Sorry, I cannot test.)

Apparently a regression since e2cc39b / 4da6d19 (?).

in reply to:  4 comment:5 by someuser, 12 years ago

Replying to cehoyos:

Could you confirm that 32e7439.avi plays fine while e2cc39b.avi fails?
(Sorry, I cannot test.)

Apparently a regression since e2cc39b / 4da6d19 (?).

Yes, 32e7439.avi plays fine, e2cc39b.avi failing.

Thanks.

comment:6 by Carl Eugen Hoyos, 12 years ago

Status: newopen

comment:7 by Michael Niedermayer, 11 years ago

Does the patch below fix the issue ?

diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index f2fa9dc..3511c81 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -523,7 +523,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
     int size= pkt->size;
 
     av_dlog(s, "dts:%s packet_count:%d stream_index:%d\n", av_ts2str(pkt->dts), avist->packet_count, stream_index);
-    while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avist->packet_count && enc->codec_id != AV_CODEC_ID_XSUB){
+    while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avist->packet_count && enc->codec_id != AV_CODEC_ID_XSUB && avist->packet_count){
         AVPacket empty_packet;
 
         if(pkt->dts - avist->packet_count > 60000){

by Carl Eugen Hoyos, 11 years ago

Attachment: e2cc39b-patched.avi added

by Carl Eugen Hoyos, 11 years ago

Attachment: 5a65fea-patched.avi added

comment:8 by Carl Eugen Hoyos, 11 years ago

I attached two files to simplify testing (both made with the patch applied).

comment:9 by someuser, 11 years ago

Great news, the patch helps - both of the files e2cc39b-patched.avi and 5a65fea-patched.avi play nicely!

Thanks!

comment:10 by Carl Eugen Hoyos, 11 years ago

Resolution: fixed
Status: openclosed

Fixed by Michael, thank you for the report!

Note: See TracTickets for help on using tickets.