Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FFmpeg subtitles commands
ffmpeg -i input.mp4 \
-map 0:1 \
-c:a copy \
-y output.m4a
for files in *flac ; \
do ffmpeg -i "$files" \
-map 0:0 \
-strict experimental \
-c:a aac \
-b:a 224k \
-y "./m4a/$files.m4a" ; \
done

Overlay

ffmpeg -i input.mp4 \
       -vf "movie=overlay.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]"
       -c:v h264
       -c:a copy
       output-overlay.mp4

Burned subs

ffmpeg -i output-overlay.mp4 \
       -vf "subtitles=input.srt" \
       -c:v h264 \
       -c:a copy \
       output-overlay-subs.mp4

Overlay et burned subs via filter_complex

ffmpeg -i input.mp4 \
	   -i input.png \
	   -filter_complex "[0:0][1:0]overlay=main_w-overlay_w-10:10,subtitles=input.srt" \
	   -c:v h264 \
	   -c:a copy \
	   output.mp4

Non-burned subs

ffmpeg -i input.mp4 \
	   -sub_charenc UTF-8 \
	   -i input.srt \
	   -vcodec copy \
	   -acodec copy \
	   -scodec mov_text \
	   -metadata:s:s:0 language=fre output.mp4

Scaling

ffmpeg -i input.mp4 \
	   -vf scale=1024:-1 \
	   -c:a copy \
	   output.mp4

Scaling

ffmpeg -i input.mp4 \
	   -s 1024/576 \
	   -c:a copy \
	   output.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.