Convert on hardware from h264 to h264 full hd, also compress audio to AAC to make a common .mp4 file.
#!/bin/env bash
# usage: enc.sh <source_file> <quality, e.g. 25, 1..51>
# https://trac.ffmpeg.org/wiki/Hardware/QuickSync
# accepts h264 and transcodes on hardware, tested.
ffmpeg -hwaccel qsv -c:v h264_qsv -i "$1" -init_hw_device qsv:hw -vf 'scale_qsv=1920:1080' -c:a aac -b:a 192K -c:v h264_qsv -global_quality:v $2 -preset:v 1 -profile:v 77 "$1-h264-aac-qsv-1080p-$2.mp4"
Convert to hevc/h265:
#!/bin/env bash
# usage: enc.sh <source_file> <quality, e.g. 25, 1..51>
# https://trac.ffmpeg.org/wiki/Hardware/QuickSync
# accepts h264 and transcodes on hardware, tested.
ffmpeg -hwaccel qsv -c:v h264_qsv -i "$1" -c:v hevc_qsv -global_quality:v $2 -preset:v 1 -profile:v 1 -c:a libopus -b:a 96K "$1-hevc-qsv-$2.mkv"
Encode to VP9 (in software):
#!/bin/env bash
# usage: enc.sh <source_file> <quality, e.g. 30, 0..63>
# https://trac.ffmpeg.org/wiki/Encode/VP9
ffmpeg -i "$1" -c:a libopus -b:a 96K -c:v libvpx-vp9 -b:v 0 -crf $2 -pass 1 -an -f null /dev/null
ffmpeg -i "$1" -c:a libopus -b:a 96K -c:v libvpx-vp9 -b:v 0 -crf $2 -pass 2 "`basename $1`_vp9tp_$2.webm"
No comments:
Post a Comment