[Ffmpeg-devel] MP4 file with incorrect frame size in header

Calvin 92 92.calvin
Tue Mar 27 00:35:09 CEST 2007

Hello VLC developpers,

I hope I am on the right mailing-list for this issue. I have a Sanyo
Xacti-C1 video camera. It saves mp4 files such as this one:
url: http://92.calvin.googlepages.com/TEST_WITH_WRONG_HEADER_SIZE.MP4
(3.8Mo- ukulele music ;)

When I open it with ffmpeg, it only detects a 320x240 video whereas it is in
reality a 640x480 video.
I gave the file to a friend of mine working in the video industry and he
told me that the video frame size written in the mp4 header was incorrect
(320x240), and that it did not correspond to the real frame size of the mp4
video stream (640x480). It seems that ffmpeg only takes into account the
upper-left part of the image based on the information found in the header.

Here is what ffmpeg says about this file:

> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'TEST_WITH_WRONG_HEADER_SIZE.MP4':
>   Duration: 00:00:14.4, start: 0.000000, bitrate: 2204 kb/s
>   Stream #0.0(eng): Video: mpeg4, yuv420p, 320x240, 29.97 fps(r)
>   Stream #0.1(eng): Audio: aac, 48000 Hz, stereo
>   Stream #0.2(eng): Data: mp4s / 0x7334706D
>   Stream #0.3(eng): Data: mp4s / 0x7334706D

When I open the file with players (such as xine, vlc), I have the same
issue, so I think they all take into account only the size in the header,
and only display the upper-left part of the image.

The only soft that can deal with it properly is avidemux. I have attached
the output given by avidemux when opening the file. You can see that it

> Found video codec type :DIVX (58564944)
>  0000 : ...?...??..  00 00 01 b0 f3 00 00 01 b5 0e e0 c0 c0 cf 00 00
>  0010 : ..... .]L(!?  01 00 00 00 01 20 00 84 5d 4c 28 a0 21 e0 a2 1f
> Startcodec:b0
> Startcodec:b5
> Startcodec:0
> Startcodec:20
> VOL Header:
>  0000 : .]L(!?  00 84 5d 4c 28 a0 21 e0 a2 1f
> 640 x 480
> MP4 Corrected size : 640 x 480

I thought you might want ffmpeg to support that type of corrupted files. It
would really be good for me (and for all Xacti-c1 owners) if the files would
load correctly.

Tell me if you need another mp4 file (I also have files with a 160x120 video
stream and a 320x240 header, so the problem is the opposite: the loaded
image is too big).

Keep up with the excellent work you are doing on ffmpeg!

My setup is the following:
-running kubuntu edgy with medibuntu sources
-FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
  configuration:  --enable-mp3lame --enable-faad --enable-gpl --enable-faac
--enable-libgsm --enable-vorbis --enable-libogg --enable-xvid --enable-a52
  libavutil version: 49.0.0
  libavcodec version: 51.11.0
  libavformat version: 50.5.0
  built on Jan 12 2007 23:31:23, gcc: 4.1.2 20060928 (prerelease) (Ubuntu

More information about the ffmpeg-devel mailing list