User Tools

Site Tools


utils_video_encoding

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
utils_video_encoding [2020/06/14 18:49]
xavier
utils_video_encoding [2020/06/18 16:19] (current)
xavier
Line 1: Line 1:
-====== Video compression ​commands and explanations ======+====== Video encoding (ffmpeg) ​commands and explanations ====== 
 + 
 +===== Compress video stream ​=====
  
 Compression without important video quality loss (tested with relatively low quality full HD source):\\ Compression without important video quality loss (tested with relatively low quality full HD source):\\
 ''​$ ffmpeg -i input -vcodec libx265 -crf 24 output''​\\ ''​$ ffmpeg -i input -vcodec libx265 -crf 24 output''​\\
 => -crf is the compression factor. Lower is better, 24 is about as low as is useful for libx265\\ => -crf is the compression factor. Lower is better, 24 is about as low as is useful for libx265\\
 +=> -map 0 to keep all streams (audio, subtitles, but also video)\\
 => Use -vf scale=-1:​720 to resize to 720p (keeping aspect ratio with -1, resulting in calculation of width)\\ => Use -vf scale=-1:​720 to resize to 720p (keeping aspect ratio with -1, resulting in calculation of width)\\
-=> Use -map 0 to keep all streams (audiosubtitles, but also video)+ 
 +===== Select language streams ===== 
 + 
 +Do not re-encode streams, keep all subtitles and select English and French audio languages:​\\ 
 +''​$ ffmpeg -i input -map 0:v -map 0:s -map 0:​m:​language:​eng -map 0:​m:​language:​fre?​ -c copy output''​\\ 
 +=> -c copy to avoid re-encoding streams\\ 
 +=> -map:0:v to keep all video streams\\ 
 +=> -map 0:s to keel all subtitle streams\\ 
 +=> -map 0:​m:​language:​eng to keep streams with english metadata defined ​(all types of streams but impacting only audio (a) since we're keeping all subtitles ​in this case)\\ 
 +=> the ? at the end of -map instruction avoids failure if the matching input is missing\\ 
 + 
 +===== Script examples ===== 
utils_video_encoding.1592160543.txt.gz · Last modified: 2020/06/14 18:49 by xavier