How to fix the bad resolution of Sanyo Xacti videos

Sanyo Xacti C5During my latest trip to Japan, I bought a Sanyo Xacti C5 camera. This hybrid digicam/videocam device is rather honest, and what I especially liked was that it directly records videos in Mpeg 4 format. Pretty nice, that you can save almost 1 hour of quality video on a 1 Gb flash!

However, I quickly noticed that something sucked about it. When I wanted to watch my recorded videos on my PC, I could only see the top-left corner of the video. Although the device records videos in 640x480, mplayer, xine, or vlc would invariably show me a 320x240-sized window with only the top-left part. Only ffplay would play them correctly (but without sound). I know my videos sucks, but this way they suck even more now.

It is no surprise that the feature is actually a bug: for unknown reasons, the video size is not correctly written in the MP4 file (it seems the Olympus C-770 is also affected). So, here is how to fix it. I have found two ways, one bad, one better.

The bad way

The bad one first: use mencoder to rewrite your file into an avi. You'll have to encode the sound, but the video will be left untouched. This can be achieved by the following command:

$ mencoder -oac mp3lame -ovc copy SCREWED-FILE.MP4 -o FIXED-FILE.avi

There are two disadvantages to this solution:

  1. There may be a little glitch at the beginning of the video. I don't know why, but it happens.
  2. Although mplayer will play the video correctly, xine will still display the top-left corner.

The better way

So here is the better version, found on this thread. You just have to use MP4Box (which most likely comes with the gpac package of your distro) to fix the video. The command to apply to every video is:

 $ MP4Box -isma -add SCREWED-FILE.MP4 FIXED-FILE.MP4

Since I already have plenty of shit recorded, I ran this little command in my top directory to fix it all:

 $ find -name "*.MP4" -execdir MP4Box -isma -add {} /tmp/MOO.MP4 \; -execdir mv /tmp/MOO.MP4 {} \;

 

Comments

Fix MP4 in VLC

I solved this way: options/input codecs/demuxer/demux module: Demuxer FFmpeg

For me also, choosing ffmpeg

For me also, choosing ffmpeg as the demuxer in VLC worked! Thanks!

Thanks so much for posting this.

The VLC fix worked best. There's no MP4Box package in the Fedora repos.

Better script

For some reason, your script did not work for me, but this one did:

#!/bin/bash
for name in *.mp4;
do MP4Box -isma -add $name fixed_$name.mp4;
done;