[FFmpeg-devel] Switching from mp4 container to avi

Jean Delvare khali at linux-fr.org
Thu Sep 8 09:30:00 CEST 2011

Hi all,

I am facing a strange container change issue for which I am seeking for

I have a series of video files in mp4 container format (xvid + mp3).
They play well on my Samsung YP-R1 PMP, but not on my (father in law's)
Sony digital TV set. That TV set plays avi container files just fine,
and so does my PMP, so I decided to convert my files from mp4 container
to avi so that I can play them on both devices.

In order to not lose quality in the process, and to make conversion as
fast as possible, I avoided recoding using the following command line:

ffmpeg -i input.mp4 -vcodec copy -acodec copy -vtag xvid copy.avi

The problem is, my PMP will refuse to play the resulting file (although
I can play it with any media player on Linux - mplayer, totem,
ffplay...) Sadly, it doesn't tell me why.

I tried without -vtag but it did not help. I tried reencoding the audio,
with the same settings used for the original audio:

ffmpeg -i input.mp4 -vcodec copy -acodec libmp3lame -ab 112k -vtag xvid new-audio.avi

but it did not help either. Then I tried reencoding the video, with the
same settings used for the original video :

ffmpeg -i input.mp4 -vcodec libxvid -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -b 640k -g 125 -acodec copy new-video.avi

and that _does_ work, but it's obviously slow and certainly degrades
video quality, so I'm not happy with this solution.

My questions now:

* Does anyone has any idea why my Samsung YP-R1 accepts to play the
  reencoded video file but refuses to play the straight-copy version?
  Is there anything ffmpeg does differently (or omits doing) when using
  -vcodec copy?

* Can anyone suggest an alternative way to convert from mp4 container
  to avi without loss?

* Is there any tool out there that can display detailed information
  about avi file headers / structure? I tried mediainfo and ffprobe but
  both claim that copy.avi and new-video.avi are identical, except for
  slight variations in sizes and average bit rates. It will be
  difficult to figure out what my PMP doesn't like about the avi file
  that doesn't play if I can't find exactly how it differs from the one
  which does play.

I can do any testing if you have suggestions, and provide small sample
files exhibiting my problem if needed.

Jean Delvare

More information about the ffmpeg-devel mailing list