ffmpeg -i input.m3u8 -c copy -bsf:a aac_adtstoasc output.mp4ffmpeg \
-f x11grab \ # Video
-select_region 1 \ # Manually draw area on display (default is 0)
-draw_mouse 1 \ # Draw cursor on video (default is 1)
-follow_mouse centered \ # "centered" - center of area follows the mouse, if specified number - follows only when the mouse pointer reaches within PIXELS
-framerate 60 \ # FPS (default is NTSC=30000/1001=29.97)
-show_region 1 \ # Show grabbed region on screen
-video_size 1920x1080 \ # If not specify - fullscreen (all displays)
-i :0.0 \ # Input video "[hostname]:display_number.screen_number[+x_offset,y_offset]"
-f pulse \ # Audio
-ac 2 \ # Audio channels
-i default \ # Input audio
output.mp4 # Output
# With audio. Check pavucontrol in tab "recording" device!
# One line
ffmpeg -f x11grab -select_region 1 -draw_mouse 1 -follow_mouse centered -framerate 60 -show_region 1 -video_size 1920x1080 -i :0.0 -f pulse -ac 2 -i default output.mp4ffmpeg -i img%03d.png -c:v libx265 -pix_fmt yuv420p -movflags +faststart -tag:v hvc1 output.mp4
# -start_number 126 # start from number (%03d)
# -pattern_type glob -i "*.jpg" # regexp (linux only)
# -vf "setpts=0.5*PTS" # x2 speed
# -framerate 24 # ?
# -r 60 # fpsffmpeg -i input.mp4 output%04d.pngffmpeg -i input.mp4 -vf "crop=<OUT_WIDTH>:<OUT_HEIGHT>:<IN_POS_X>:<IN_POS_Y>" -c:a copy output.mp4
# Can be used variables: in_w and in_h - sizes of input video
# In center auto
ffmpeg -i input.mp4 -vf "crop=in_h:in_h:in_w/2-in_h/2:0" -c:a copy output.mp4ffmpeg -i input.mp4 -vf scale=320:-1 -c copy output.mp4ffmpeg -i input.mp4 -vf "transpose=N" output.mp4
# Where N:
# 0 = 90CounterCLockwise and Vertical Flip (default)
# 1 = 90Clockwise
# 2 = 90CounterClockwise
# 3 = 90Clockwise and Vertical Flip
# Current docs note that "Numerical values are deprecated, and
# should be dropped in favor of symbolic constants. Thus cclock_flip,
# clock, cclock or clock_flip instead of 0, 1, 2 or 3
# (ffmpeg.org/ffmpeg-filters.html#transpose)ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" output.mp4 # faster 2x
ffmpeg -i input.mp4 -filter:v "setpts=2*PTS" output.mp4 # slower 0.5xold_extension=$1 # from ext
new_extension=$2 # to ext
for i in *."$old_extension";
do ffmpeg -i "$i" -vcodec h264 -acodec aac <...> "${i%.*}.$new_extension";
done
# Using
script.sh avi mp4Size. Example: -s 1280x720
Start time. Example: -ss 00:00:30
If specified before -i, it very fast (input will be parsed using keyframes).
If specified after -i, it very slowly (frame by frame; the main advantage is that when applying filters to the output stream, the timestamps aren't reset prior to filtering, but the drawback is that it will take a lot of time until it finally reaches that time point).
Note that if you specify -ss before -i only, the timestamps will be reset to zero, so -t and -to will have the same effect. If you want to keep the original timestamps, add the -copyts option.
Duration. Example: -t 00:00:15
Example: -ss 00:00:15 -t 00:00:10 (select 00:00:15-00:00:25)
End timestamp. Example: -to 00:00:15
Example: -ss 00:00:15 -to 00:00:40 (select 00:00:15-00:00:40)
Frame rate. Example: -r 30
No audio. Example: -an
Get some stream from HLS. For get info about streams need execute only ffmpeg -i <URL>.
Video filter.
Video filter.
You can add -movflags +faststart as an output option if your videos are going to be viewed in a browser. This will move some information to the beginning of your file and allow the video to begin playing before it is completely downloaded by the viewer. It is not required if you are going to use a video service such as YouTube. source