cutvid: Fix degraded video quality with hardcoded subtitles
- Extract subtitles first - Only do 1 encoding pass
This commit is contained in:
parent
b07ee2ccef
commit
41b83f13a5
|
@ -35,19 +35,17 @@ local vencoder="copy"
|
|||
local aencoder="copy"
|
||||
[[ ${#o_vencoder} -eq 2 ]] && vencoder=${o_vencoder[2]}
|
||||
[[ ${#o_aencoder} -eq 2 ]] && aencoder=${o_aencoder[2]}
|
||||
local subtitle_options=(-codec:s copy)
|
||||
|
||||
if [[ ${#o_hardcode_subs} -ne 0 ]]; then
|
||||
local tmpass=$(mktemp --suffix='.cutvid.ass')
|
||||
ffmpeg -i ${input} -y ${tmpass}
|
||||
subtitle_options=(-sn -vf ass=${tmpass} )
|
||||
fi
|
||||
|
||||
ffmpeg -i ${input} \
|
||||
-ss ${from} -to ${to} \
|
||||
-codec:v ${vencoder} -codec:a ${aencoder} -codec:s copy \
|
||||
-codec:v ${vencoder} -codec:a ${aencoder} ${subtitle_options} \
|
||||
${ffmpeg_options} ${output}
|
||||
|
||||
# NOTE: only works with ASS at the moment
|
||||
if [[ ${#o_hardcode_subs} -ne 0 ]]; then
|
||||
local tmpass=$(mktemp --suffix='.cutvid.ass')
|
||||
ffmpeg -i ${output} -y ${tmpass}
|
||||
ffmpeg -sn -i ${output} -vf ass=${tmpass} \
|
||||
-codec:v ${vencoder} -codec:a copy \
|
||||
hardcoded_sub_${output}
|
||||
mv --verbose hardcoded_sub_${output} ${output}
|
||||
rm --verbose ${tmpass}
|
||||
fi
|
||||
[[ ${#o_hardcode_subs} -ne 0 ]] && rm --verbose ${tmpass}
|
||||
|
|
Loading…
Reference in New Issue
Block a user