This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
public:it:ffmpeg [2022/01/25 20:00] – phil | public:it:ffmpeg [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== ffmepg ====== | ||
- | * [[https:// | ||
- | |||
- | * https:// | ||
- | * https:// | ||
- | * https:// | ||
- | * | ||
- | * https:// | ||
- | * https:// | ||
- | * https:// | ||
- | * https:// | ||
- | * https:// | ||
- | |||
- | |||
- | ===== Build ===== | ||
- | |||
- | * https:// | ||
- | |||
- | ===== Manipulating audio channels | ||
- | |||
- | * https:// | ||
- | * https:// | ||
- | * https:// | ||
- | |||
- | ==== 5.1 Surround downmix to stereo ==== | ||
- | FL, FC, FR, BL, BR, LFE -> FL, FR | ||
- | < | ||
- | -ac 2 \ | ||
- | -af " | ||
- | </ | ||
- | |||
- | |||
- | ==== 7.1 downmix to stereo ==== | ||
- | FL, FC, FR, SL, SR, BL, BR, LFE -> FL, FR | ||
- | < | ||
- | -ac 2 \ | ||
- | -af " | ||
- | </ | ||
- | |||
- | |||
- | ==== 6.1 downmix to stereo==== | ||
- | FL, FC, FR, SL, SR, BC, LFE -> FL, FR | ||
- | < | ||
- | -ac 2 \ | ||
- | -af " | ||
- | </ | ||
- | |||
- | ==== 5.0 downmix to stereo ==== | ||
- | FL, FC, FR, BL, BR -> FL, FR | ||
- | < | ||
- | -ac 2 \ | ||
- | -af " | ||
- | </ | ||
- | |||
- | ==== Quadraphonic Channel downmix to stereo==== | ||
- | FL, FR, BL, BR -> FL, FR | ||
- | < | ||
- | -ac 2 \ | ||
- | -af " | ||
- | </ | ||
- | |||
- | ==== Linear Surround Channel downmix to stereo ==== | ||
- | FL, FC, FR -> FL, FR | ||
- | < | ||
- | -ac 2 \ | ||
- | -af " | ||
- | </ | ||
- | |||
- | ===== Scaling ===== | ||
- | |||
- | ==== QSV Scale to 1080p ==== | ||
- | |||
- | Quality with QSV as not good at all, though this could have been my fault. | ||
- | < | ||
- | ffmpeg \ | ||
- | -y \ | ||
- | -hwaccel qsv \ | ||
- | -qsv_device / | ||
- | -c:v hevc_qsv \ | ||
- | -i input.mkv \ | ||
- | -c:v hevc_qsv \ | ||
- | -vf ' | ||
- | -preset slow \ | ||
- | -global_quality 25 \ | ||
- | -c:a copy \ | ||
- | -c:s copy \ | ||
- | output.mkv | ||
- | </ | ||
- | |||
- | |||
- | ==== 4k to 1080p ==== | ||
- | |||
- | * libx264 | ||
- | * libx265 | ||
- | |||
- | < | ||
- | ffmpeg \ | ||
- | -i MyMovie_4K.mkv \ | ||
- | -vf scale=1920: | ||
- | -c:v libx265 \ | ||
- | -preset veryslow \ | ||
- | -c:a copy \ | ||
- | MyMovie_1080p.mkv | ||
- | </ | ||
- | |||
- | Not sure if these are necessary. | ||
- | < | ||
- | -crf 28 | ||
- | </ | ||
- | |||
- | |||
- | ===== Subtitles ===== | ||
- | |||
- | ==== MKV Embed soft subtitles ==== | ||
- | * [[https:// | ||
- | < | ||
- | ffmpeg \ | ||
- | -i in.mkv \ | ||
- | -f srt \ | ||
- | -i in.srt \ | ||
- | -map 0:0 \ | ||
- | -map 0:1 \ | ||
- | -map 1:0 \ | ||
- | -c:v copy \ | ||
- | -c:a copy \ | ||
- | -c:s srt \ | ||
- | out.mkv | ||
- | </ | ||
- | |||
- | ==== MKV hardcode subtitles ==== | ||
- | |||
- | http:// | ||
- | |||
- | < | ||
- | ffmpeg \ | ||
- | -i " | ||
- | -vf subtitles=fullsubs.srt \ | ||
- | " | ||
- | </ | ||
- | |||
- | |||
- | ==== MKV to MP4 hardcode subtitles and downmix 5.1 to stereo ==== | ||
- | |||
- | < | ||
- | # export english subs | ||
- | ffmpeg \ | ||
- | -y \ | ||
- | -i " | ||
- | -map 0:s:0 \ | ||
- | eng.srt | ||
- | |||
- | # create a version with hardsubs | ||
- | # si=0 | ||
- | ffmpeg \ | ||
- | -y \ | ||
- | -i " | ||
- | -vf subtitles=" | ||
- | -ac 2 \ | ||
- | -af " | ||
- | -c:a aac \ | ||
- | " | ||
- | |||
- | </ | ||
- | ==== Delay subtitle by 1 second ==== | ||
- | |||
- | < | ||
- | ffmpeg \ | ||
- | -itsoffset -1 \ | ||
- | -i full8.srt \ | ||
- | -c copy \ | ||
- | full8_delayed.srt | ||
- | </ | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ====== Video Streaming ====== | ||
- | |||
- | https:// | ||
- | https:// | ||
- | |||
- | |||
- | ffmpeg -h encoder=hevc_qsv | ||
- | |||
- | |||
- | ====== Clips ====== | ||
- | |||
- | |||
- | < | ||
- | ffmpeg \ | ||
- | -i input.mkv \ | ||
- | -ss 29:36 \ | ||
- | -to 29:50 \ | ||
- | -c:v copy \ | ||
- | -c:a aac \ | ||
- | output.mp4 | ||
- | </ | ||
- | |||
- | |||
- | |||
- | ====== h264 to hevc using nvenc ====== | ||
- | |||
- | - Install docker | ||
- | - Install nvidia docker: https:// | ||
- | - Docker ffmpeg image: https:// | ||
- | |||
- | < | ||
- | docker run \ | ||
- | -v $(pwd): | ||
- | -w $(pwd) \ | ||
- | --runtime=nvidia jrottenberg/ | ||
- | -hwaccel cuvid \ | ||
- | -c:v h264_cuvid \ | ||
- | -i input.mkv \ | ||
- | -c:v hevc_nvenc \ | ||
- | -c:a copy \ | ||
- | -c:s copy \ | ||
- | -preset slow \ | ||
- | output_hevc.mkv | ||
- | </ |