


Trimming can be done with or without -c copy, if you leave out -c copy, ffmpeg will re-encode the output file.Ĭopy only the first 60 seconds of a video:įfmpeg -i input.mp4 -t 60 -c copy output.mp4Ĭopy 2.5 minutes from the middle of a video without re-encoding it:įfmpeg -ss "00:00:59.59" -i "input.mp4" -c copy -map 0 -to "00:03:30.00" "output.mp4" Mux video and audio Times and duration can be given as hh:mm:ss.msec or a simple number of seconds. To Trim a file, add the options -ss -t or -to

This can give a jagged appearance on a computer monitor.ĭeinterlace a file using "yet another deinterlacing filter".įfmpeg -i input.mp4 -vf yadif output.mp4 Extracting partial content Interlaced video is generated for TV/broadcasting with even lines are captured for one half frame followed by the odd lines in the next half frame. mp4 specifying a high bitrate (-b) audio for best quality sound.įfmpeg -i ~/input.webm -c:v libx264 -c:a aac -strict experimental -b:a 192k output.mp4 Deinterlace mp3 specifying a high bitrate (-b) audio for best quality sound.įfmpeg -i ~/input.webm -b:a 192k ~/output.mp3Ĭonvert a. High-quality encoding using -crf (Constant Rate Factor) and -preset:įfmpeg -i input.mp4 -preset slower -crf 18 output.mp4Ĭonvert a. Specify the codecs for both video (-c:v) and audio (-c:a)įfmpeg -i input.mp4 -c:v vp9 -c:a mp3 output.mkvĮncode the audio as mp3 and copy the video stream unchanged: ffmpeg -i input.mp4 -c:v copy -c:a mp3 output.mkv mkv (another container format):įfmpeg -i input.webm -c:av copy output.mkv ':av' is the default so this could also be specified with just -c copy:įfmpeg -i input.mkv -c:av copy output.mp4

Remux from MKV (a container format) into MP4 (another container format), lossless copy without re-encoding. A cross-platform solution to record, convert and stream audio and video.
