Build Process
Make Subtitles for a video:
export LD_LIBRARY_PATH = /usr/local/lib
./ffmpeg - i 38c3-598-deu-eng-fra-Wir_wissen_wo_dein_Auto_steht_-_Volksdaten_von_Volkswagen_hd.mp4 \
- vn - af " whisper=model=../whisper.cpp/models/ggml-base.en.bin\
:language=en\
:queue=3\
:destination=output.srt\
:format=srt" - f null -
ffmpeg - i 38c3-598-deu-eng-fra-Wir_wissen_wo_dein_Auto_steht_-_Volksdaten_von_Volkswagen_hd.mp4 \
- i output.srt - c copy - c :s mov_text test_out.mp4
Transcribe from microphone:
ffmpeg - loglevel warning - f pulse - i default \
- af ' highpass=f=200,lowpass=f=3000,whisper=model=../whisper.cpp/models/ggml-medium.bin\
:language=en\
:queue=10\
:destination=-\
:format=json\
:vad_model=../whisper.cpp/models/ggml-silero-v5.1.2.bin' - f null -
Rewrap a file
ffmpeg - i input_video.mkv - c copy - map 0 input_video.avi
Re-transcode a file to h.264
ffmpeg - i input_file - c :v libx264 - pix_fmt yuv420p - c :a aac - preset veryslow - movflags +faststart output_file
Re-transcode a file to h.265
ffmpeg - i input_file - c :v libx265 - pix_fmt yuv420p - c :a aac - preset veryslow - crf 18 - movflags +faststart output_file
Re-transcode a file to h.265
ffmpeg - i input_file - c :v libx265 - pix_fmt yuv420p - c :a aac - preset veryslow - crf 18 - movflags +faststart output_file
Create high quality GIF:
ffmpeg - ss HH:MM:SS - i input_file - filter_complex " fps=10,scale=500:-1:flags=lanczos,palettegen" - t 3 palette.png
Fix MP3 tags:
ffmpeg - i file_orig.mp3 - acodec copy file_fixed.mp3
Extract and encode Audio from video:
ffmpeg - i input-video.avi - vn - acodec copy output-audio.aac
Add another audio track to video:
ffmpeg - i input_video.mkv - i new_audio.mp3 - map 0 - map 1:a - c :v copy - shortest output.mkv
Split audio and video tracks:
ffmpeg - i input_file - map 0:v:0 video_output_file - map 0:a:0 audio_output_file
Fix Audio Sync
ffmpeg - i input_file - c :v copy - c :a pcm_s16le - af " aresample=async=1000" output_file
Transcode to FLAC:
flac -- best -- keep-foreign-metadata -- preserve-modtime -- verify input.wav
Transcode from FLAC:
flac -- decode -- keep-foreign-metadata -- preserve-modtime -- verify input.flac
Join video files together:
ffmpeg - i input_1.avi - i input_2.mp4 - filter_complex " [0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[video_out][audio_out]" - map " [video_out]" - map " [audio_out]" output_file
Split file into segments:
ffmpeg - i input_file - c copy - map 0 - f segment - segment_time 60 - reset_timestamps 1 output_file-% 03 d.mkv
Trim File:
ffmpeg - i input_file - ss 00:02:00 - to 00:55:00 - c copy - map 0 output_file
Merge audio and video tracks:
ffmpeg - i video_file - i audio_file - map 0:v - map 1:a - c copy output_file
Embed a subtitle file into a movie file:
ffmpeg - i input_file - i subtitles_file - c copy - c :s mov_text output_file
Strips metadata from video file:
ffmpeg - i input_file - map_metadata - 1 - c :v copy - c :a copy output_file
Rip a DVD:
Rip a Blu-ray:
makemkvcon - r -- decrypt -- progress= -same mkv dev:/dev/sr0 0 .
Find Blackbars and remove them:
>> > ffmpeg - i input_t00.mkv - t 120 - vf cropdetect=24:16:0 - f null - 2 >& 1 | grep - oP ' crop=\d+:\d+:\d+:\d+' | sort | uniq - c | sort - rn | head - 5
2801 crop=1920:800:0:140
1 crop=1840:800:6:140
Re-encode Blu-ray:
ffmpeg - i " input_t00.mkv" - vf crop=1920:800:0:140 - c :v libx265 - crf 22 - preset slower - x265-params " deblock=-1,-1:\
sao=0:\
me=umh:\
subme=7:\
merange=57:\
b-adapt=2:\
rc-lookahead=60:\
ref=6:\
bframes=8:\
aq-mode=3:\
aq-strength=0.8:\
psy-rd=2.0:\
psy-rdoq=1.0:\
rdoq-level=2:\
no-open-gop=1:\
keyint=240:\
min-keyint=24" - c :a copy - c :s copy - map 0 " output_encoded.mkv"