2023-12-15 14:10:37 +01:00
|
|
|
processed_intro_path=$PWD/out/intro-processed.mp4
|
|
|
|
processed_outro_path=$PWD/out/outro-processed.mp4
|
|
|
|
|
|
|
|
echo łączenie video z dźwiękiem:
|
2023-12-28 14:05:51 +01:00
|
|
|
ffmpeg -y -vaapi_device /dev/dri/renderD128 \
|
2023-12-15 14:10:37 +01:00
|
|
|
-i out/video.mp4 -i $input_mono \
|
|
|
|
-video_track_timescale $timescale \
|
|
|
|
-tune stillimage \
|
|
|
|
-c:a aac \
|
|
|
|
-ac 1 \
|
|
|
|
-strict experimental \
|
|
|
|
-vf 'format=nv12,hwupload' \
|
|
|
|
-c:v h264_vaapi \
|
|
|
|
out/video-and-audio.mp4
|
|
|
|
|
|
|
|
echo reencoding intro to enable fast concat...
|
|
|
|
|
|
|
|
function reencode_for_demux_compatibility() {
|
2023-12-28 14:32:59 +01:00
|
|
|
ffmpeg -y -i "$1" \
|
2023-12-15 14:10:37 +01:00
|
|
|
-pix_fmt yuv420p \
|
|
|
|
-r $framerate \
|
|
|
|
-video_track_timescale $timescale \
|
|
|
|
-ac 1 \
|
|
|
|
-b:a 320k \
|
|
|
|
"$2"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
reencode_for_demux_compatibility "$intro" "$processed_intro_path"
|
|
|
|
|
|
|
|
if [ "$intro" = "$outro" ]; then
|
|
|
|
processed_outro_path="$processed_intro_path"
|
|
|
|
else
|
|
|
|
reencode_for_demux_compatibility "$outro" "$processed_outro_path"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "" >out/demuxer-branding.txt
|
|
|
|
echo "file $processed_intro_path" >>out/demuxer-branding.txt
|
|
|
|
echo "file video-and-audio.mp4" >>out/demuxer-branding.txt
|
|
|
|
echo "file $processed_outro_path" >>out/demuxer-branding.txt
|
|
|
|
|
|
|
|
cat out/demuxer-branding.txt
|
|
|
|
|
2023-12-28 14:05:51 +01:00
|
|
|
ffmpeg -y -f concat -safe 0 -i out/demuxer-branding.txt -c:v copy -b:a 320k "$final_output"
|