Wednesday, January 12, 2011

encoding mono video for windows

I was attempting to figure out why one of the computers at school would not play a media file with sound, the media file played fine on my laptop, and the instructor’s office computer, but not on the classroom computer.

After trying various players, and converting the media file to various formats, it continued to not play with sound. I continued by trying other media files that I had on my laptop, they appeared to play fine. Eventually I noticed a light crackle after a fairly low quality conversion, which was a hint that is might have to do with audio channels. At this point I tried using mono output in VLC and the sound came out clear.

After making a tree of files that would not play properly in the same way, I converted the whole batch of videos using the following bit of shell code. The codecs I used are ones that stock windows understands.

# low quality mono (256kb)
# medium quality mono (512kb)
# high quality mono (1024kb)

find . -type d -print |
while read x ; do
  mkdir -p ../out/"$x"

find . -type f |
while read file ; do
  ffmpeg -i "$file" -acodec wmav2 -vcodec msmpeg4v2 -ab $ABR -b $VBR -ac 1 "../out/$file.avi" < /dev/null

No comments:

Post a Comment