ubuntu:video:convert_h265_to_h264
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ubuntu:video:convert_h265_to_h264 [2020/02/23 13:59] – peter | ubuntu:video:convert_h265_to_h264 [2023/06/13 10:56] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Ubuntu - Video - Convert H265 to H264 ====== | ||
- | |||
- | <code bash> | ||
- | ffmpeg -i input.mkv -c copy output.mp4 | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Matroska output ===== | ||
- | |||
- | <code bash> | ||
- | mkdir h264vids | ||
- | for f in *.mp4; do ffmpeg -i " | ||
- | </ | ||
- | |||
- | * Will output to a directory named h264vids. | ||
- | * Assumes your inputs are .mp4. If not, change the .mp4 instance in the example to your input file type, or just use the greedy * by itself. | ||
- | * Adjust -crf for quality and -preset for encoding speed/ | ||
- | |||
- | See [[https:// | ||
- | |||
- | ---- | ||
- | |||
- | ===== MP4 output ===== | ||
- | |||
- | This example is a little more complicated. | ||
- | |||
- | This will perform conditional encoding depending if the input audio is AAC or not. | ||
- | |||
- | If the input audio is AAC then the audio will be stream copied (re-muxed) as is and needless re-encoding is avoided. | ||
- | |||
- | If the input audio is not AAC then it will be re-encoded to AAC. | ||
- | |||
- | <code bash> | ||
- | #!/bin/bash | ||
- | |||
- | mkdir h264vids | ||
- | |||
- | for f in *.mkv | ||
- | do | ||
- | audioformat=$(ffprobe -loglevel error -select_streams a:0 -show_entries stream=codec_name -of default=nw=1: | ||
- | if [ " | ||
- | ffmpeg -i " | ||
- | else | ||
- | ffmpeg -i " | ||
- | fi | ||
- | done | ||
- | </ | ||
- | |||
- | * Will output to a directory named h264vids. | ||
- | * Assumes your inputs are .mkv. If not, change the .mkv instance in the example to your input file type, or just use the greedy * by itself. | ||
- | * See note above regarding -crf and -preset. | ||
- | * You can pause the encoding with ctrl+z and resume with fg. | ||
- | |||
- | ---- | ||
- | |||
- | ===== Using ffmpeg ===== | ||
- | |||
- | <code bash> | ||
- | for file in *265.mkv; do nice -n19 ffmpeg -i $file -c copy -c:v libx264 ${file/ | ||
- | </ | ||
- | |||
- | * Assumes that the files have always a name ending in 265.mkv. | ||
- | * This ending will be replaced with 264.mkv. | ||
- | |||
- | ---- | ||
- | |||
- | ===== Using libav ===== | ||
- | |||
- | <code bash> | ||
- | sudo apt-get install libav-tools | ||
- | avconv -i oldvideo.mkv -ar 22050 convertedvideo.mp4 | ||
- | </ | ||
ubuntu/video/convert_h265_to_h264.1582466372.txt.gz · Last modified: 2020/07/15 09:30 (external edit)