ffmpeg -i INPUT_FILE.mkv -c copy -pix_fmt yuv420p10le -c:v libx265 -preset slow -crf 27 -profile:v main10 OUTPUT_FILE.mkv
ffmpeg -i INPUT -filter:v fps=30 OUTPUT
ffmpeg -i INPUT -vf scale=-1:720 OUTPUT
Make a file with the paths to concat (think this can be relative or absolute)
cat mylist.txt
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
then use
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4
ffmpeg -i input.wav -filter:a volumedetect -f null /dev/null
Then read the output from the command log:
[Parsed_volumedetect_0 @ 0x7f8ba1c121a0] mean_volume: -16.0 dB
[Parsed_volumedetect_0 @ 0x7f8ba1c121a0] max_volume: -5.0 dB
See AudioVolume wiki page for more
# Increase track audio by 10dB
-filter:a "volume=10dB"
# Reduce volume by 5dB
-filter:a "volume=-5dB"
# 150% of current volume
-filter:a "volume=1.5"
-c:a ac3 -ac 2
-c:a aac -b:a 192k
ffmpeg -i input.mkv -map 0:v:0 -map 0:a:1 -map 0:a:0 -c copy output.mkv
# use video stream (0:0)
# make 2nd audio stream the 1st, make 1st audio stream the 2nd
# use the new 1st audio stream as default
# remove the default from the new 2nd audio stream
ffmpeg -i "input.mkv" -map 0:v -map 0:a:1 -map 0:a:0 -disposition:a:0 default -disposition:a:1 none -c copy "output.mkv"
Delay or speed up one input
# Make subtitles happen 2s later
ffmpeg -itsoffset 2 -i subtitles.srt -c copy subtitles_delayed.srt
# Make subtitles happen 700ms earlier
ffmpeg -itsoffset -0.7 -i subtitles.srt -c copy subtitles_advanced.srt
ffmpeg -txt_format text -i input_file out.srt
-metadata:s:a:1 language=jpn
-metadata:s:a:0 title="English (5.1 Surround)" -metadata:s:a:1 title="English (Stereo)" -metadata:s:a:2 title="Français"
-dn -map_metadata:c -1
Note: this will remove chapter names in some cases, but unlike -map_chapters -1
it should preserve the chapter markers themselves. See this SO post for more
To change the output frame rate to 30 fps, use the following command [source]:
ffmpeg -i <input> -filter:v fps=30 <output>
# Video from file 1, audio from file 2, subs from file 1. show subs by default.
ffmpeg -i INPUT_1.mkv -i INPUT_2.mkv -c copy -map 0:v -map 1:a -map 0:s -disposition:s:0 default -disposition:a:1 default OUTPUT_FILE.mkv
An_Archivists_Guide_To_Matroska/metadata.md
(from the "Archivist's Guide" linked above)
-metadata KEY="VALUE"
Example:
ffmpeg -f lavfi -i testsrc -t 1 -metadata ARCHIVAL=yes -metadata PRESERVE_THIS=okay -metadata DESCRIPTION="Just color bars" some_metadata.mkv
ffmpeg -i <input> -i chapter-metadata-file -c copy -map_metadata 1 <output>
Example chapter text file contents:
[CHAPTER]
TIMEBASE=1/1000
START=1
END=448000
title=The Pledge
[CHAPTER]
TIMEBASE=1/1000
START=448001
END= 3883999
title=The Turn
See this site for a helpful script to convert from time, title
pairs.
ffmpeg -h encoder=libx265 | grep pixel
ffmpeg -i INPUT.mp4 -i INPUT.en.srt -c copy -map 0:v -map 0:a -map 1:s -pix_fmt yuv420p10le -c:v libx265 -crf 29 -x265-params profile=main10 -disposition:s:0 default "Output.mkv"