Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Hide

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Extract audio stream from an AVI file using mencoder

Terminal - Extract audio stream from an AVI file using mencoder
mencoder "${file}" -of rawaudio -oac mp3lame -ovc copy -o audio/"${file/%avi/mp3}"
2009-02-15 14:57:54
User: fulat2k
5
Extract audio stream from an AVI file using mencoder

This commands saves the output in the audio directory. The portion ${file/%avi/mp3} uses bash string replacement to replace the avi to mp3 within the ${file} variable.

Alternatives

There are 2 alternatives - vote for the best!

Terminal - Alternatives
mencoder "${file}" -of rawaudio -oac mp3lame -ovc copy -o "${file%.*}.mp3"
2012-12-14 03:49:52
User: Tungmar
0

This command extracts the audio stream of the video in $file and stores it in a file where the original suffix is changed to .mp3

Know a better way?

If you can do better, submit your command here.

What others think

If you want it without being mp3 compressed try this

mplayer $avi -vc null -vo null -ao pcm:fast:file=$wav

Comment by maht 284 weeks and 4 days ago

I did a batch operation on multiple files with

for file in `ls -1`;do mencoder "${file}" -of rawaudio -oac mp3lame -ovc copy -o audio/"${file/%avi/mp3}";done

assuming audio/ directory has been created beforehand.

This is simply an awesome one-liner. Thank you for sharing this!

Comment by xCrucialDudex 190 weeks and 1 day ago

Two things i've learned using this:

1) using mencoder is faster than "mplayer -audiodump"; the latter will play the entire video in normal speed as it dumps the audio.

2) If your files have spaces on their names use:

$ for file in *; do mencoder "${file}" -of rawaudio -oac lavc -ovc copy -o audio/"{file/%avi/}mp2";done

Comment by edutiao 156 weeks and 1 day ago

i also have this kinds of needs recently, and after long google search, i accidentally find a step by step guide on how to extract audio from MKV, MOV, MP4, WMV, AVI, MPG, VOB, 3GP, FLV, WebM, SWF, F4V, DivX, Xvid, ASF, RMVB, MVI, WTV, DVR, H.264, DV, MXF, AVCHD, MOD, TOD, MTS and etc at http://www.bigasoft.com/articles/audio-extractor-extract-audio-from-mp4-flv-avi-mkv-mov-wmv.html

It did help me to extract audio from mkv files and then allow me to save them as mp3, wmv, or wav

hope it also helps you

Comment by grahambuddhenry 79 weeks and 1 day ago

Follow the step by step guide how to extract audio from video at http://www.idealshare.net/extract-audio-from-video-mp4-avi-flv-mov-wmv-mkv-vob.html

This guide helps to:

Extract audio in MP3, AAC, AC3, WAV, WMA, Apple Lossless, M4A, DTS, AIFF, MP2, AU, RA, FLAC, OGG and etc from video files.

Extract audio from all kinds of video files like extract audio from MP4, extract audio from FLV, extract audio from AVI, extract audio from MOV, extract audio from MKV, extract audio from WMV, ASF, SWF, VOB, OGV, WTV, RMVB, WebM, MVI, MXF, AVCHD, MPEG, 3GP, and etc.

Comment by teamsuccessta 10 weeks and 6 days ago

Your point of view

You must be signed in to comment.

Related sites and podcasts