Commands tagged ffmpeg (80)

  • yt2mp3(){ for j in `seq 1 301`;do i=`curl -s$1/uploads\?start-index=$j\&max-results=1|grep -o "watch[^&]*"`;ffmpeg -i `wget$i -qO-|grep -o 'url_map"[^,]*'|sed -n '1{s_.*|__;s_\\\__g;p}'` -vn -ab 128k "`youtube-dl -e ${i#*=}`.mp3";done;} squeezed the monster (and nifty ☺) command from 7776 from 531 characters to 284 characters, but I don't see a way to get it down to 255. This is definitely a kludge!

    Command in description (Your command is too long - please keep it to less than 255 characters)
    __ · 2011-02-03 08:25:42 1
  • Gives stereo, 16bit, 44.1kHz (default in Ubuntu/Medibuntu ffmpeg). -aq 2 = 220-250kbit/s VBR, lower number is better quality. 2 or 3 should be good for most people. If you want the best mp3 q you should remove -aq and use -ab 320k to get 320kbit/s, but that is probably overkill for most .flv videos.

    ffmpeg -i input.flv -aq 2 output.mp3
    maedox · 2011-02-16 15:05:41 0
  • ffmpeg [source specification if needed] -i $src -an -vcodec libx264 -coder 0 -threads 0 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -level 13 -g 15 -crf 25 -s 320x224 -aspect 16:9 -r 15 -b 186000 -vb 186000 -minrate 176700 -maxrate 195300 -bt 9300 -bufsize 262500 -muxrate 195300 -vglobal 1 -f rtp rtp://$dstIP:$dstVideoPort1 -vn -acodec libfaac -async 2 -flags +global_header -ac 1 -ar 44100 -ab 64000 -f rtp rtp://$dstIP:$dstAudioPort1 -newaudio -an -vcodec libx264 -coder 0 -threads 0 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -level 13 -g 20 -crf 25 -s 320x224 -aspect 16:9 -r 20 -b 286000 -vb 286000 -minrate 271700 -maxrate 300300 -bt 14300 -bufsize 367500 -muxrate 300300 -vglobal 1 -f rtp rtp://$dstIP:$dstVideoPort2 -newvideo -vn -acodec libfaac -async 2 -flags +global_header -ac 1 -ar 44100 -ab 64000 -f rtp rtp://$dstIP:$dstAudioPort2 -newaudio -an -vcodec libx264 -coder 0 -threads 0 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -level 30 -g 25 -crf 25 -s 480x336 -aspect 16:9 -r 25 -b 386000 -vb 386000 -minrate 366700 -maxrate 405300 -bt 19300 -bufsize 472500 -muxrate 405300 -vglobal 1 -f rtp rtp://$dstIP:$dstVideoPort3 -newvideo -vn -acodec libfaac -async 2 -flags +global_header -ac 2 -ar 44100 -ab 64000 -f rtp rtp://$dstIP:$dstAudioPort3 -newaudio -an -vcodec libx264 -coder 0 -threads 0 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -level 30 -g 25 -crf 25 -s 480x336 -aspect 16:9 -r 25 -b 686000 -vb 686000 -minrate 651700 -maxrate 720300 -bt 34300 -bufsize 787500 -muxrate 720300 -vglobal 1 -f rtp rtp://$dstIP:$dstVideoPort4 -newvideo -vn -acodec libfaac -async 2 -flags +global_header -ac 2 -ar 44100 -ab 64000 -f rtp rtp://$dstIP:$dstAudioPort4 -newaudio Show Sample Output

    ffmpeg -i $src -an -vcodec [...details in description...] rtp rtp://$dstIP:$dstAudioPort4 -newaudio
    theflyingbear · 2011-07-29 15:36:37 0
  • sxga ==> 1280x1024 vga ==> 800x600 ------------------------------------------------ xwininfo -root | grep geometry ------------------------------------------------

    ffmpeg -f alsa -i default -f x11grab -s sxga -r 10 -i :0.0 -f mp4 -s vga -sameq out.mp4
    kev · 2011-09-18 15:10:56 0
  • A simple command to extract audio from flv/mp4 video file. Just change extentions...

    ffmpeg -i video.flv audio.ogg
    aminehmida · 2012-03-05 23:43:45 0
  • 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 !!! ;) Show Sample Output

    a=$(xwininfo |gawk 'BEGIN {FS="[x+ \t]*"} /-geometry/ {print int(($3+1)/2)*2"x"int(($4+1)/2)*2"+"$5"+"$6}') ; echo ${a} ; ffmpeg -f x11grab -s ${a} -r 10 -i :0.0 -sameq -f mp4 -s wvga -y /tmp/out.mpg
    dwygo · 2012-08-31 14:48:41 0
  • -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

    ffmpeg -i source.mpg -r 24 -f image2 still-%6d.png
    manuq · 2013-01-10 02:49:15 0
  • -i sets the source file -f and -acodec both set the output to be raw audio, PCM signed 16-bit little endian

    ffmpeg -i source.mpg -f s16le -acodec pcm_s16le audio.raw
    manuq · 2013-01-10 02:54:04 0
  • 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. Show Sample Output

    ffmpeg -i "input.mts" -vcodec copy -acodec pcm_s16le ""
    lgarron · 2014-01-24 13:00:07 0
  • 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.

    curl 'AudioStream' | ffmpeg -i - -acodec libvorbis file.ogg
    snipertyler · 2014-03-31 02:07:20 1
  • Before you use this command you want to replace everything after the "https:" with the url of the video which you want to download. This string and it's switches will use "youtube-dl" to download the Youtube url into the directory/folder where it is called from. It will output the video using the same name as Youtube uses.

    youtube-dl -c -o "%(title)s" -f 18
    tg3793 · 2014-06-12 23:31:55 0

  • 0
    ffmpeg -i input.mpg -deinterlace -pix_fmt yuv420p -vcodec libx264 -preset slow -vprofile high -trellis 2 -crf 20 -ac 2 -ab 192k -f mp4 -ss 5:00.000 -to 25:00.000 output.avi
    xplora1a · 2014-08-23 10:29:15 0
  • This will dump a raw BGRA pixel stream and WAV which must then be converted to video: ffmpeg -f rawvideo -c:v rawvideo -s 1280x720 -r 12 -pix_fmt bgra -i "${i%.*}".bgra -c:v libx264 -preset veryslow -qp 0 -movflags +faststart -i "${i%.*}".wav -c:a libfdk_aac -b:a 384k "${i%.*}".mp4 ; rm "${i%.*}".bgra "${i%.*}".wav Our example generates an x264/720p/12fps/AAC best-quality MP4. To get dump-gnash, first install the build-dependencies for gnash (this step is OS-specific). Then: git clone ; cd gnash ; ./ ; ./configure --enable-renderer=agg --enable-gui=dump --disable-menus --enable-media=ffmpeg --disable-jemalloc ; make

    i=in.swf; dump-gnash -1 -j 1280 -k 720 -D "${i%.*}"[email protected] -A "${i%.*}".wav "${i}"
    mhs · 2015-05-06 23:52:39 2
  • Works on *.mp4 as well. Show Sample Output

    avconv -i vid.avi
    lowrez · 2015-10-16 22:49:52 0
  • to view on another box: nc <server address> <port> | ffplay - use -r to adjust FPS and -q to adjust compression. use on trusted network only as nc is unencrypted.

    ffmpeg -f x11grab -s $(xrandr | awk '/*/ {print $1}') -r 10 -i :0 -an -q 10 -f mjpeg - | nc -lp <port>
    misterhat · 2015-12-21 17:15:30 0
  • Uses ffmpeg to convert all that annoying .FLAC files to MP3 files keeping all the Artist's information in them. There's not much more to it. Show Sample Output

    find . -name "*.flac" -exec ffmpeg -i {} -ab 160k -map_metadata 0 -id3v2_version 3 {}.mp3 \;
    gustavohmsilva · 2016-06-28 19:35:06 0
  • It loops through all files in current directory that have flac extension and converts them to mp3 files with bitrate of 320kpbs using ffmpeg and default codec.

    for FILE in *.flac; do ffmpeg -i "$FILE" -b:a 320k "${FILE[@]/%flac/mp3}"; done;
    Orkan · 2016-07-04 04:13:17 0
  • Replace video and audio extension according to your needs

    ffmpeg -i
    miskopo · 2016-07-19 08:39:24 0
  • ffmpeg and avconv didnt have this feature. I use this command to hardsubs mkv files to mp4

    mpv file.mkv -o out.mp4
    zodman · 2016-09-09 18:40:01 0
  • I use this command to stream live video to facebook from a vps. you need first convert the file to flv i use mpv to encode with hardsubs a file. and then run ffmpeg to stream the file.

    mpv file.mkv -o out.flv --oac=libmp3lame --oacopts=b=128000; ffmpeg -re -i output-003.flv -f flv 'rtmp://'
    zodman · 2016-09-09 18:43:00 0

  • 0
    ffmpeg -i out.mp4 -i logo.png3 -filter_complex "overlay=0:0" -codec:a copy out2.mp4 -y
    zodman · 2016-09-09 21:07:25 0
  • ffprobe doesn't throw an error and was actually made to do exactly that. Usually ffprobe is located in the same folder as ffmpeg.

    ffprobe -i filename.flv
    Yamy · 2016-10-15 20:26:34 0

  • 0
    ffmpeg -start_number 10 -i image-%04d.png -vframes 100 output.webm
    atemvm · 2017-04-05 18:27:29 0
  • Converts an OGG file to MP3 at desired quality, preserving the id3v2 tags.

    ffmpeg -i input.ogg -ab 256k -map_metadata 0:s:0 output.mp3
    woohoo · 2018-08-11 21:44:27 0
  • Fix for PHP Shell Exec: ffmpeg -i input.mp4 -f null /dev/null 2>&1 shell_exec("ffmpeg -i input.mp4 -f null /dev/null 2>&1"); Show Sample Output

    ffmpeg -i input.mp4 -f null /dev/null
    Dipo · 2018-11-06 13:44:46 0
  •  < 1 2 3 4 > 

What's this? is the place to record those command-line gems that you return to again and again. 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.

Share Your Commands

Check These Out

Binary clock
Fun idea! This one adds seconds and keeps running on the same line. Perl's probably cheating though. :)

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

list block devices
Shows all block devices in a tree with descruptions of what they are.

All what exists in dir B and not in dir A will be copied from dir B to new or existing dir C
Assumed dir A, B, C are subdirs of the current dir Exact syntax of the command is: rsync -v -r --size-only --compare-dest=/path_to_A/A/ /path_to_B/B/ /path_to_C/C/ (do not omit end-slashes, since that would copy only the names and not the contents of subdirs of dir B to dir C) You can replace --size-only with --checksum for more thorough file differences validation Useful switch: -n, --dry-run perform a trial run with no changes made

CPU architecture details
This command list all CPU technical infos.

Show apps that use internet connection at the moment.
This corrects duplicate output from the previous command.

Protect your eye
Redshift will adjust the color temperature and protects eye at night -b : will adjust the brightness

Press Any Key to Continue
Halt script progress until a key has been pressed. Source:

Ping Twitter to check if you can connect
Returns a JSON object, by connecting to the 'test' endpoint of the Twitter API. Simplest way to check if you can connect to Twitter. Output also available in XML, use '/help/test.xml' for that

Show current iptables rules, with line numbers

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.


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: