Question:
Is there a way to tell what encoding was used in a video file?
anonymous
2013-04-19 11:44:54 UTC
i have a handfull of MP4 video files. over a dozen. each of them are full length movies. some of them are encoded in h.264. but not all of them. some of them started life as an AVI or a WMV and was converted to MP4. but i don't know what encoding was used on those. all i know is that the MP4 files that are encoded in h.264 work on my android tablet. and the ones that aren't don't. i have a simple h.264 encoder program on my PC. i can reencode them and fix it, its a non issue. but i have so many of them. i don't want to reencode what i don't have too, it takes to long. so if i knew how each of them were encoded i could save myself lots of time. :/ i am on windows 7. but i do have a Linux box if i need it.
Three answers:
anonymous
2013-04-19 12:03:07 UTC
Use the free utility MediaInfo. It will show the codecs (video & audio) that were used to make the video as well as other info.

http://mediainfo.sourceforge.net/en/Download
Charlie Kelly
2013-04-19 22:27:30 UTC
Linux is definitely your best bet.



I think there is a software that uses python and can grab the codec information, but you can also use something like avconv to output the information, grab the line you need about the codec, and then convert if it's not h.264.



In linux it would look something like,

##note, pseudocode, run and you might have a no good bad day.

convH264(){

if avconv $1 | grep h.264

then

echo "File $1 is already encoded to h.264"

else

echo "File $1 is not encoded to h.264, converting..."

avconv -i "$1" "$1.mp4" #pseudocode

fi

}



^^ That could be a function, and then you just need to pipe something like find into it.



find . | convH264



Find would list all the files recursively from where you ran 'find .' so avconv would test everything.
jplatt39
2013-04-19 19:12:32 UTC
Yes there is. I'm a Linux user and I've known about it for years from this old how to create a DVD page:



http://www.linux.com/news/software/multimedia/8250-convert-any-video-file-to-dvd-with-open-source-tools



The key is the first part. If you have mplayer you can do an



mplayer -ao dummy -vo dummy -identify your_video.mp4



And it will tell you what codec your file uses. Get mplayer at:



http://www.mplayerhq.hu



If that's how you want to go. I'm sure there are other ways but I've always found this easy.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...