[Ffmpeg-devel] Two ASF related bugs and fixes

emild at cs.technion.ac.il emild
Tue Apr 18 16:11:06 CEST 2006


Hello,

I have found two bugs related to ffmpeg's ASF file format.

1) The first bug has to do with the ASF writer. The problem is caused by the
fact that the size of the padding is not adjusted to include the size of
the padding length field. This causes the last byte of the payload to be
overwritten with zeroes before it is written to disk, thus yielding an invalid
bitstream.
mplayer and even ffmpeg complain when such streams are passed to them.

I have put an input file which illustrates the problem at:

ftp://ftp.mplayerhq.hu/MPlayer/incoming/ASF_PROBLEM/WRITER/IN/Philips_qcif.mp4

and the resulting output at:

ftp://ftp.mplayerhq.hu/MPlayer/incoming/ASF_PROBLEM/WRITER/OUT/buggy_Philips_qcif.mp4.asf

The command line used was:

ffmpeg -i Philips_qcif.mp4 -r 15 -b 64 -an -s 176x144 -vcodec wmv1
buggy_Philips_qcif.mp4.asf


For example this is what mplayer has to say about the resulting output file:

.
.
.
[wmv1 @ 009E3CB8]overreading 142 bits
[wmv1 @ 009E3CB8]concealing 99 DC, 99 AC, 99 MV errors
[wmv1 @ 009E3CB8]ac-tex damaged at 5 8
[wmv1 @ 009E3CB8]
error while decoding block: 5 x 8 (5)
[wmv1 @ 009E3CB8]Error at MB: 101
[wmv1 @ 009E3CB8]concealing 99 DC, 99 AC, 99 MV errors
.
.
.

Passing the resulting file to ffpmeg as input yields similar results.
The attached patch asf_enc_fix.diff should fix this problem. The file
good_Philips_qcif.mp4.asf is the file generated after the fix.



2) The second bug has to do with the ASF file format reader. The reader ignores
the size of the ASF data object and keeps on reading even beyond it. Therefore
if the ASF file includes an index object at its end, the reader will treat the
index like data, but of course will fail since it thinks that the data is
corrupted. When reading an asf file with an index object, ffmpeg will complain
at the end of the file that it read an invalid header. 

For example this is how ffmpeg complains when attempting to convert a valid ASF
file with index to mpeg:

ffmpeg -i good_Philips_qcif.mp4.asf -r 30 -an -s 176x144 
good_Philips_qcif.mp4.asf.mpg

I have used the correct ASF file from:

ftp://ftp.mplayherhq.hu/MPlayer/incoming/ASF_PROBLEM/WRITER/OUT/good_Philips_qcif.mp4.asf

.
.
.
[asf @ 0x8308470]ff asf bad header 90  at:429226ate= 287.5kbits/s
[asf @ 0x8308470]ff asf skip 3138  0


I have fixed the problem so that the reader will not attempt to read beyond the
end of the data object. At the same time, I have changed some fields that were
int to int64_t.

The attached patch asf_dec_fix.diff fixes this problem.



                                                        Best regards,

                                                                  Emil
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: asf_enc_fix.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060418/9052f552/attachment.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: asf_dec_fix.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060418/9052f552/attachment.txt>



More information about the ffmpeg-devel mailing list