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

Commands tagged video from sorted by
Terminal - Commands tagged video - 67 results
ffmpeg -an -f video4linux -s 320x240 -b 800k -r 15 -i /dev/v4l/video0 -vcodec mpeg4 myvideo.avi
2009-06-19 17:41:43
User: dcabanis
3

The option -an disables audio recording, -f forces the use of video4linux for the input, -s sets the video to the size 320x240, -b sets the recording bitrate, -r sets the frame rate to 15fps, -i gives the input device, -vcodec sets the output format.

Press Q to stop recording or you can specify the recording time with the -t option like -t 00:1:30

mencoder video.avi lavc -lavcopts vcodec=mpeg4:vbitrate=800 newvideo.avi
2009-06-19 17:30:46
User: dcabanis
1

Encode video.avi into newvideo.avi using the libav codec to produce an MPEG4 file with a bitrate of 800

mencoder -tv device=/dev/video1 tv:// -ovc copy -o video.avi
2009-06-19 17:21:33
User: dcabanis
1

video.avi is the resulting file. Press Ctrl+c to stop the recording. You can change the OVC option to another to record into a different format.

ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 /tmp/outputFile.mpg
2009-06-05 21:11:17
User: dcabanis
Tags: video X11 ffmpeg
46

Grab X11 input and create an MPEG at 25 fps with the resolution 800x600

ffmpeg -i source_movie.flv -vcodec mpeg2video target_video.m2v -acodec copy target_audio.mp3
2009-05-23 23:52:51
User: dcabanis
4

rips the audio and video stream of a movie. The two streams are stored separately.

ffmpeg -i source_audio.mp3 -itsoffset 00:00:10.2 -i source_video.m2v target_video.flv
2009-05-23 23:47:41
User: dcabanis
4

This assumes that there is a 10.2 sec delay between the video and the audio (delayed).

To extract the original video into a audio and video composites look at the command on extracting audio and video from a movie

ffmpeg -i mymovie.mpg -ar 22050 -acodec libmp3lame -ab 32K -r 25 -s 320x240 -vcodec flv mytarget.flv
2009-05-23 23:39:46
User: dcabanis
2

Takes an mpeg video and coverts it to a youtube compatible flv file.

The -r 25 sets the frame rate for PAL, for NTSC use 29.97

ffmpeg -i source.flv -vn acodec copy destination.mp3
2009-05-23 23:34:32
User: dcabanis
2

-vn removes tha video content, the copy option tells ffmpeg to use the same codec for generating the output

lspci |grep VGA
2009-04-28 08:34:42
User: CafeNinja
Functions: grep lspci
Tags: video Ubuntu
1

Displays only the VGA adapter/chipset being used for the graphics. In this case, it gave me the "M22" and "Mobility Radeon x300" that I needed to research a graphics issue I was having.

mplayer -framedrop -vfm ffmpeg -lavdopts lowres=1:fast:skiploopfilter=all
2009-04-27 15:40:55
User: baergaj
Tags: video mplayer
11

Certain codecs in high res don't play so well on my Dell Mini 9. Using this command, I can play just about anything and it keeps the sound in sync to boot!

ffmpeg -i file.flv -r 15 -b 128k -s qcif -acodec amr_nb -ar 8000 -ac 1 -ab 13 -f 3gp -y out.3gp
2009-03-23 14:30:45
User: jjclarkson
Tags: video ffmpeg
5

Download YouTube videos as .flv and convert them to .3gp for your mobile phone.

mencoder -ovc copy -oac copy -of avi -o remuxed.avi original.avi
2009-03-23 10:15:36
User: iain
6

When playback of AVI files (containing a video format like XviD or DivX) is stuttering, it in 90% of the files is caused by a poorly or wrongly interleaved file. The issue can be permanently resolved by RE-MUXING the AVI video-files that have this problem

ffmpeg -vcodec copy -acodec copy -i orginalfile -ss 00:01:30 -t 0:0:20 newfile
2009-03-16 12:58:07
User: ako
20

With:

-vcodec, you choose what video codec the new file should be encoded with. Run ffmpeg -formats E to list all available video and audio encoders and file formats.

copy, you choose the video encoder that just copies the file.

-acodec, you choose what audio codec the new file should be encoded with.

copy, you choose the audio encoder that just copies the file.

-i originalfile, you provide the filename of the original file to ffmpeg

-ss 00:01:30, you choose the starting time on the original file in this case 1 min and 30 seconds into the film

-t 0:0:20, you choose the length of the new film

newfile, you choose the name of the file created.

Here is more information of how to use ffmpeg:

http://www.ffmpeg.org/ffmpeg-doc.html

mencoder -vf rotate=1 -ovc lavc -oac copy "$1" -o "$1"-rot.avi
mencoder "$1" -ofps 23.976 -ovc lavc -oac copy -o "$1".avi
mplayer -dumpstream -dumpfile "yourfile" -playlist "URL"
2009-02-28 22:18:17
User: Alanceil
9

I use this command to save RTSP video streams over night from one of our national TV stations, so I won't have to squeeze the data through my slow internet connection when I want to watch it the next day.

For ease of use, you might want to put this in a file:

#!/bin/bash

FILE="`basename \"$1\"`"

mplayer -dumpstream -dumpfile "$FILE" -playlist "$1"

function encode4phone() { ffmpeg -acodec libamr_nb -vcodec h263 -i "$1" -s qcif -b 200k -ac 1 -ab 7.4k -ar 8000 "$1.3gp" }