Commands matching ffmpeg (189)

  • Strips the audio track from a webm video. Use this in combination with clive or youtube-dl.


    0
    for file in "$@"; do name=$(basename "$file" .webm) echo ffmpeg -i $file -vn -c:a copy $name.ogg ffmpeg -i "$file" -vn -c:a copy "$name.ogg" done
    hoodie · 2013-10-05 14:49:07 9
  • 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


    0
    ffmpeg -i "input.mts" -vcodec copy -acodec pcm_s16le "output.mov"
    lgarron · 2014-01-24 13:00:07 6
  • This command is used to stream a video file as live to some streaming server like Wowza, Red5 . etc


    0
    ffmpeg -re -i localFile.mp4 -c copy -f flv rtmp://server/live/streamName
    unni9946 · 2014-03-07 05:52:11 7
  • After updating to the latest ffmpeg with homebrew


    0
    ffmpeg -i $video -c:v prores -profile:v 2 -c:a copy ${video}.mov
    brainstorm · 2014-03-10 16:24:34 18
  • 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.


    0
    curl 'AudioStream' | ffmpeg -i - -acodec libvorbis file.ogg
    snipertyler · 2014-03-31 02:07:20 7
  • I needed to convert a screen capture when using Gnome's "recordmydesktop" and convert it to a .wmv for playback in Windows.


    0
    ffmpeg -i input.ogv -qscale 0 output.wmv # convert .ogv to .wmv
    mpb · 2014-06-24 16:23:18 7

  • 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 9

  • 0
    find -type f -exec ffmpeg -i "{}" "{}".mp3 \;
    aarntesla · 2014-10-30 19:43:58 8

  • 0
    ffmpeg -i filename -vn -acodec libvorbis out.ogg
    longqi · 2014-12-31 12:46:55 10
  • Full command: for f in input/*; do BN=$(basename "$f"); ffmpeg -i "$f" -vn "temp/$BN.flac"; sox "temp/$BN.flac" "temp/$BN-cleaned.flac" noisered profile 0.3; ffmpeg -i "$f" -vcodec copy -an "temp/$BN-na.mp4"; ffmpeg -i "temp/$BN-na.mp4" -i "temp/$BN-cleaned.flac" "output/$BN"; done This was over the 255 character limit and I didn't feel like deliberately obfuscating it. 1. Create 'input', 'output' and 'temp' directories. 2. Place the files that you want to remove the hiss/static/general noise from in the input directory. 3. Generate a noise reduction profile with sox using 'sox an_input_file.mp4 -n trim x y noiseprof profile', where x and y indicates a range in seconds that only the sound you want to eliminate is present in. 4. Run the command.


    0
    for f in input/*; do BN=$(basename "$f"); ffmpeg -i "$f" -vn "temp/$BN.flac"...
    samcamwilliams · 2015-03-01 02:48:19 8
  • Change bitrate with option '-b'


    0
    ssh user@host ffmpeg -b 200 -an -f video4linux2 \ -s 960x720 -r 10 -i /dev/video0 -b 200 -f ogg - \ | mplayer - -idle -demuxer ogg
    dkaliberda · 2015-02-27 19:05:26 8
  • -ss start time -t duration -i file name -vf scale=320:-1 scale 320 X auto -r fps


    0
    ffmpeg -ss 00:00:00.000 -t 10 -i filename.avi -vf scale=320:-1 -r 10 /tmp/output.gif
    maxwux · 2015-04-22 06:52:03 9
  • disharmonics between 44100 and others cleaned


    0
    ffmpeg -loglevel 0 -y -i audio.mp3 -f sox - | sox -p -V -S -b32 -t alsa hw:CA0106 gain -3 rate -va 1411200 rate -v 96k
    george23 · 2016-01-26 14:41:05 13
  • 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 http://git.savannah.gnu.org/r/gnash.git ; cd gnash ; ./autogen.sh ; ./configure --enable-renderer=agg --enable-gui=dump --disable-menus --enable-media=ffmpeg --disable-jemalloc ; make


    0
    i=in.swf; dump-gnash -1 -j 1280 -k 720 -D "${i%.*}".bgra@12 -A "${i%.*}".wav "${i}"
    mhs · 2015-05-06 23:52:39 27
  • sox's interpolator creating bitperfect big soundfiles for audiofil ears, two passes computing takes long time and creating big archives


    0
    ffmpeg -loglevel 0 -y -i audio.mp3 -f sox - | sox -p -V -S -b24 -t audio.flac gain -3 rate -va 14112000 rate -v 96000
    george23 · 2016-09-20 13:25:13 14
  • Converts an OGG file to MP3 at desired quality, preserving the id3v2 tags.


    0
    ffmpeg -i input.ogg -ab 256k -map_metadata 0:s:0 output.mp3
    woohoo · 2018-08-11 21:44:27 294

  • 0
    ffmpeg -i orig_video.wmv audio_out.wav
    lolssl · 2015-10-02 12:55:39 10
  • The "map" may be different depending on the .wmv file. run `ffprobe` to see which is the video-track in the .wmv file usually this is "0.0". Stream #0.0: Video:... Stream #0.1: Audio: .. and "1.0" corresponds to the 2nd input file - your new audio. You may want to add "-acodec wmav2" and "-ar 128k" options for 128kbit/s Windows Media Audio 2 or whatever audio-codec/quality your want. `ffmpeg -codecs | grep "EA"` gives you a list of available codecs for Encoding Audio. Try using '-sameq' instead of '-vcodec copy' (re-encode the video with same quality rather than a bit-exact copy - this often solves muxing issues but will cause a small loss of either video quality or increased bandwidth). and also try a different output format eg. 'new_video.avi' or '..mov' instead of 'new_video.wmv'. you may need both, this should work: ffmpeg -i vid.wmv -i aud.wav -sameq -map 0.0 -map 1.0 output.avi


    0
    ffmpeg -i orig_video.wmv -i new_audio.wav -vcodec copy -map 0.0 -map 1.0 new_video.wmv
    lolssl · 2015-10-02 12:56:27 13
  • Works on *.mp4 as well. Show Sample Output


    0
    avconv -i vid.avi
    lowrez · 2015-10-16 22:49:52 10
  • Music Library Convert Usage lc Old_Directory New_DIrectory Old_Format New_Format lc ~/Music ~/Music_ogg mp3 ogg This will convert all audio files in the old directory to the new directory from the old format to the new format. It will leave the original library alone. The converted library will retain folder structure.


    0
    lc() { od="$1"; nd="$2"; of=$3; nf=$4; cp -rl "$od" "$nd"; find $nd -type f -iname \*$of -print -execdir ffmpeg -i {} -loglevel error -q:a 6 {}.$nf \; -execdir rm {} +; find $nd -type f -iname \*.$of.$nf -execdir rename "s/$of.$nf/$nf/" {} +; }
    snipertyler · 2015-12-16 20:16:01 18
  • 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.


    0
    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 11

  • 0
    ffmpeg -loop 1 -i image.jpg -i audio.m4a -c:v libx264 -c:a aac -strict experimental -b:a 192k -vf scale=720:-1 -shortest video-output.mp4
    andresaquino · 2016-01-02 18:01:17 11
  • Requires ffmpeg with image2pipe filter and imagemagick Show Sample Output


    0
    ffmpeg -i input.mp4 -vf scale=w=320:h=-1 -r 10 -f image2pipe -vcodec ppm - | convert -delay 5 -loop 0 - output.gif
    TheMadScientist · 2016-01-08 17:21:37 11
  • 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


    0
    find . -name "*.flac" -exec ffmpeg -i {} -ab 160k -map_metadata 0 -id3v2_version 3 {}.mp3 \;
    gustavohmsilva · 2016-06-28 19:35:06 10

  • 0
    ffmpeg -i input.mp4 -vcodec libx264 -crf 30 output.mp4
    ctcrnitv · 2018-08-13 23:29:50 302
  • ‹ First  < 4 5 6 7 8 > 

What's this?

commandlinefu.com 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

back up your commandlinefu contributed commands
Use `zless` to read the content of your *rss.gz file: $ zless commandlinefu-contribs-backup-2009-08-10-07.40.39.rss.gz

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Let's make screen and ssh-agent friends
When you start screen as `ssh-agent screen`, agent will die after detatch. If you don't want to take care about files when stored agent's pid/socket/etc, you have to use this command.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Find the package that installed a command

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Get the size of all the directories in current directory (Sorted Human Readable)
This allows the output to be sorted from largest to smallest in human readable format.

Remove spaces from filenames - through a whole directory tree.
An example of zsh glob qualifiers.

Recursively grep for string and format output for vi(m)
This is a big time saver for me. I often grep source code and need to edit the findings. A single highlight of the mouse and middle mouse click (in gnome terminal) and I'm editing the exact line I just found. The color highlighting helps interpret the data.

Unite pdf files
pdfunite is a part of the poppler-utils. poppler-utils package is only 150KB. The alternative - pdftk package is 14MB! Install poppler-utils if you need simple pdf operation commands like unite, separate, info, text/html conversions


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: