container file and codec

Having just finished this, I was hoping someone can explain very briefly
about the container file.

I converted a video using the following command:


ffmpeg -i DWTOlson720_20.avi -vcodec libx264 -crf 23 DWTOlson720_23.mpg

This file would not play using mplayer or any other player.

However, then I made only one small change, making the file an .avi file
instead of .mpg, like so:


ffmpeg -i DWTOlson720_20.avi -vcodec libx264 -crf 23 DWTOlson720_23.avi

This video ran without a problem. The first video, I tried changing the
file extension, but it would not play.

I have looked up for a more thorough explanation on google, but it seems
that everyone says the extension of a video file is just a container and
doesn’t really matter. I know that can’t be the case.

Are certain extensions only to be used by certain codecs? Or is there
some other simple explanation?


G.O.
Box #1: 12.2 | KDE 4.9.2 | AMD Phenom IIX4 | 64 | 16GB
Box #2: 12.2 | KDE 4.9.1 | AMD Athlon X3 | 64 | 4GB
Laptop: 12.2 | KDE 4.9.2 | Core i7-2620M | 64 | 8GB
learning openSUSE and loving it

Yes, some container formats are limited. https://en.wikipedia.org/wiki/Comparison_of_container_formats

If the file doesn’t play back, try playing it with ffplay to see if it has any error messages:

ffplay /path/to/file.mpg

It might also be interesting to use the file command to determine what is different between the files for sure. Open up terminal and type:

file "/path/filename"

If the file is in the default folder, no need for a path to be specified. If there are no spaces in the name, no need to use the quotes. Come back with what file says.

Thank You,

have a look through here

Comparison of container formats - Wikipedia, the free encyclopedia

the mpeg container only supports mpeg1 and mpeg2 while an avi container supports “almost anything”

btw - changing the extension does not change the container. e.g. if you have a matroska file with a .mkv extension and change that to a .avi extension there is virutally no change - other than confusing your media player maybe. It still remains a matroska container.

On 01/25/2013 12:46 PM, farcusnz wrote:
> have a look through here ‘Comparison of container formats - Wikipedia,
> the free encyclopedia’
> (http://en.wikipedia.org/wiki/Comparison_of_container_formats) the
> mpeg container only supports mpeg1 and mpeg2 while an avi container
> supports “almost anything” btw - changing the extension does not
> change the container. e.g. if you have a matroska file with a .mkv
> extension and change that to a .avi extension there is virutally no
> change - other than confusing your media player maybe. It still
> remains a matroska container.
Thanks everyone for assisting in my understanding. I understand now a
little better and this explains why when I changed the extension it
didn’t help!


G.O.
Box #1: 12.2 | KDE 4.9.2 | AMD Phenom IIX4 | 64 | 16GB
Box #2: 12.2 | KDE 4.9.1 | AMD Athlon X3 | 64 | 4GB
Laptop: 12.2 | KDE 4.9.2 | Core i7-2620M | 64 | 8GB
learning openSUSE and loving it