[Techtalk] video, audio codecs

Miriam English mim at miriam-english.org
Sat Sep 24 21:56:57 UTC 2011


Little Girl wrote:
> Hey there,
>
> Miriam English wrote:
>>
>> #! /bin/sh
>> cd "$1"
>> for f in *
>> do
>>     echo "$f"
>>     mplayer "$f" -v -ao null -vo null -frames 0 2>/dev/null | grep
>> "audio codec:"
>>     mplayer "$f" -v -ao null -vo null -frames 0 2>/dev/null | grep
>> "VIDEO:" echo
>> done
>
> I would love to try this, but can't tell what the "waffle" characters
> are representing. Can you attach it as a text file?

Oops, sorry. :) They are just ANSII escape codes. They're not necessary. 
I make extensive use of them in my scripts so that I can easily see 
important parts of the output. The echo with the gobbledegook simply 
writes the video filename out in red.

The unprintable characters are the code for escape. I should have made 
it more universally usable by writing that line as:
     echo -e "\e[31m $f \e[0m"
It still might not work on all systems, but it works this way:
-e  lets the echo command accept escape codes
\e  is (on some systems) the escape code for ESC or ASCII char 27
\e[31m  is the ANSII code to switch on red-colored text
\e[0m  restores all ANSII modifiers to normal
I added a couple of spaces to make the $f filename variable more 
visible, but they aren't needed.

That line would work just as well as simply:
     echo "$f"

Sorry about that. :)

By the way, if you want mplayer it is a brilliant video player (the 
best, in my opinion) available at:
http://www.mplayerhq.hu

Most Linux distros have an mplayer package available for those who 
prefer not to compile.

It comes with "mencoder" which is an incredibly versatile sound and 
video encoder. Its use is fairly involved though, and takes quite a 
while to slog through the enormous manual. I've made a few simple 
scripts for myself that remove most of the need to remember much of it. 
If you want them let me know.

Best wishes,

	- Miriam

-- 
If you don't have any failures then you're not trying hard enough.
  - Dr. Charles Elachi, director of NASA's Jet Propulsion Laboratory
-----
Website: http://miriam-english.org
Blogs:   http://miriam-e.dreamwidth.org
          http://miriam-e.livejournal.com


More information about the Techtalk mailing list