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/
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.
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.
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:
If you're using the experimental vorbis encoder (homebrew version of libffmpeg)
This removes the video and subsequent file size and directly copies the audio.
This encodes it in ogg format.
Does on-the-fly encoding of the incoming stream.
Great for radio streams as they're often flv format.
This *does not change the video encoding*, so it's fast (almost purely I/O-bound) and results in a file of nearly the same size.
However, OSX (and possibly other programs) will more easily play/seek the file when wrapped as MOV. For example, you can QuickLook the resulting file.
This basically does the same as the commercial ClipWrap program, except using the free program ffmpeg.
Note: %~nI expands %I to a file name only (cf. http://technet.microsoft.com/en-us/library/bb490909.aspx)
Take a picture from your webcam and save it to a jpeg.
A very slightly modified version of MarxBro's command.
sox (SOund eXchange) can capture the system audio be it a browser playing youtube or from hardware mic and can pipe it to ffmpeg which encodes it into flv and send it over rtmp.
Tested using Red5 rtmp server.
mp4box is great when working with mp4s
This command takes a 1280x1024 p picture from the webcam.
If prefer it smaller, try changing the -s parameter: qqvga is the tiniest, vga is 640x480, svga is 800x600 and so on.
Get your smile on and press enter! :)
-i sets the source file
-f and -acodec both set the output to be raw audio, PCM signed 16-bit little endian
-i sets the source file
-r sets the output frame rate, set it to the same frame rate as the input to output each frame
-f sets the output format, trough it might be guessed by the extension
Now we can capture only a specific window (we have to chose by clicking on it)
ffmpeg complains about "Frame size must be a multiple of 2" so we calculate the upper even number with (g)awk trickery.
We remove the grep, we are already using (g)awk here ....why losing time with grep !!! ;)
Alternative, imho better, using the concat protocol
Play with the framerate option '-r' to scale back bandwidth usage.
The '-s' option is the captured screan area, not the rescaled size. If you want to rescale add a second '-s' option after '-i :0'. Rescaling smaller will also decrease bandwidth.
A simple command to extract audio from flv/mp4 video file.
Just change extentions...
Takes all the .3gp files in the directory, rotates them by 90 degrees, and saves them in the lossless ffv1 encoding.
If this rotates in the wrong direction, you may want transponse=1
Re-encoding to ffv1 may result in a significant increase in file size, as it is a lossless format. Other applications may not recognize ffv1 if they don't use ffmpeg code. "huffyuv" might be another option for lossless saving of your transformations.
The audio may be re-encoded as well, if the encoding used by your 3gp file doesn't work in a avi container.
ffprobe is specially intended to get video information
Faster thumbnail creation than '-itsoffset'
ffmpeg -itsoffset -4 -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg
sxga ==> 1280x1024
vga ==> 800x600
xwininfo -root | grep geometry
map the video of video.mp4 to the video of mix.mp4
map the audio of audio.mp3 to the audio of mix.mp4
make sure that video.mp4 and audio.mp3 have the same duration
With the -vn switch we make our intentions clear and ask FFmpeg not to bother itself with the video. Next we specify the audio codec copy, which tells FFmpeg to use the same codec to encode the audio, which it uses to decode it. To keep things simple, we'll just keep the sampling and bitrate values the same.