ffmpeg -i file.mov -c copy out.mp4
you can remove audio by using the -an
flag
ffmpeg -i input.mov -vcodec libx264 -crf 20 output.mp4
The CRF, which, in this case, is 20, can range from 18 to 24, where a higher number will compress the output to a smaller size.
The video codec used here is x264
Reference from here
use the -ss
option to specify a start timestamp, and the -t
option to specify the encoding duration. The timestamps need to be in HH:MM:SS.xxx format or in seconds
Example for clipping 10 seconds, 30 seconds from the start:
ffmpeg -ss 00:00:30.0 -i input.wmv -c copy -t 00:00:10.0 output.wmv
ffmpeg -ss 30 -i input.wmv -c copy -t 10 output.wmv
Note that -t is an output option and always needs to be specified after -i
.
Use the -to
arg to specify the target end time
ffmpeg -i <input> -filter:v fps=fps=30 <output>
To take every 15th frame, use
ffmpeg -i in.mp4 -vf select='not(mod(n,15))',setpts=N/FRAME_RATE/TB out.mp4
Another method is to use the framestep filter
ffmpeg -i in.mp4 -vf framestep=15,setpts=N/FRAME_RATE/TB out.mp4
ffmpeg -i filename
For more see this post
The font file path you need is probably gonna be at /usr/share/fonts
on Linux or '/Library/Fonts/'
on MacOS
ffmpeg -i input.mp4 -vf "drawtext=fontfile=Arial.ttf: text='Frame\: %{frame_num}': start_number=0: x=(w-tw)/2: y=h-(2*lh): fontcolor=black: fontsize=20: box=1: boxcolor=white: boxborderw=5" -c:a copy output.mp4
This create a video that's like this:
ffmpeg -i input.mp4 -q:a 0 -map a output_file.m4a
-q:a
: variable bitrate with 0 being the highest quality-map a
: select audio stream only- file extension, in general
m4a
is a good idea because ffmpeg should be smart enough to guess your intent and figure out the right codec of your output audio file and encapsulate the raw AAC into the output M4A container
ffmpeg -i /input/track1.m4a a -i ~/input/track2.m4a -filter_complex '[0:0][1:0]concat=n=2:v=0:a=1[out]' -map '[out]' output/track.m4a
for adding a third track simple replace [0:0][1:0]concat=n=2
with [0:0][1:0][2:0]concat=n=3