Introduce adding the original audio to the pipeline, as well as intro/outro
This commit is contained in:
parent
d8a8aae71d
commit
d96d4373f4
9
demux.sh
Normal file
9
demux.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
echo "generating the demuxers..."
|
||||||
|
|
||||||
|
# generuje ścieżki do złożenia przez ffmpega:
|
||||||
|
ts-node generate-demuxer.ts >out/demuxer.txt
|
||||||
|
|
||||||
|
# używa demuxer.txt żeby skleić końcowe video z dźwiękiem:
|
||||||
|
echo generowanie całości
|
||||||
|
ffmpeg -y -f concat -safe 0 -i out/demuxer.txt -r $framerate -video_track_timescale $timescale -tune stillimage -pix_fmt yuv420p out/video.mp4
|
||||||
|
# ^ daję safe 0 aby przyjmowało bezwzględne ścieżki
|
37
generate.sh
37
generate.sh
@ -6,34 +6,17 @@
|
|||||||
# W katalogu z tym skryptem musisz mieć katalog "pics", w którym są pliki "left.png", "right.png", "none.png" i "both.png"
|
# W katalogu z tym skryptem musisz mieć katalog "pics", w którym są pliki "left.png", "right.png", "none.png" i "both.png"
|
||||||
#
|
#
|
||||||
|
|
||||||
input=/home/kuba/Downloads/odc36trim.mp3 # tutaj dajemy ścieżkę do pliku mp3 z Arkiem w jednym kanale i Kubą w drugim
|
export input=~/Downloads/icdw3/stereo-processed.wav # tutaj dajemy ścieżkę do pliku mp3 z Arkiem w jednym kanale i Kubą w drugim
|
||||||
framerate=25
|
export input_mono=~/Downloads/icdw3/mono-processed.wav # tutaj dajemy ścieżkę do pliku mp3 z Arkiem w jednym kanale i Kubą w drugim
|
||||||
timescale=25000
|
export intro=~/projects/midline/podcast-visualizer/out/intro.mp4 # glitch
|
||||||
|
export outro=~/projects/midline/podcast-visualizer/out/intro.mp4 # to samo na końcu, co na początku
|
||||||
|
export final_output=~/Downloads/icdw3-viz.mp4
|
||||||
|
export framerate=25
|
||||||
|
export timescale=25000
|
||||||
|
|
||||||
aresample=8000 # to bez zmian
|
aresample=8000 # to bez zmian
|
||||||
|
|
||||||
echo dzielimy mp3 na dwa osobne wav
|
|
||||||
ffmpeg -i $input -map_channel 0.0.0 /tmp/left.wav -map_channel 0.0.1 /tmp/right.wav
|
|
||||||
|
|
||||||
echo na dwóch wątkach generujemy surowe pliki
|
|
||||||
ffmpeg -i /tmp/left.wav -ac 1 -filter:a aresample=$aresample -map 0:a -c:a pcm_u8 -f data - > /tmp/leftraw &
|
|
||||||
ffmpeg -i /tmp/right.wav -ac 1 -filter:a aresample=$aresample -map 0:a -c:a pcm_u8 -f data - > /tmp/rightraw &
|
|
||||||
|
|
||||||
# czekamy aż obydwa wątki się zakończą
|
|
||||||
wait;
|
|
||||||
|
|
||||||
echo "generating the demuxers...";
|
|
||||||
|
|
||||||
# generuje ścieżki do złożenia przez ffmpega:
|
|
||||||
ts-node generate-demuxer.ts > out/demuxer.txt
|
|
||||||
|
|
||||||
mkdir -p out
|
mkdir -p out
|
||||||
|
|
||||||
# używa demuxer.txt żeby skleić końcowe video z dźwiękiem:
|
source ./split.sh
|
||||||
echo generowanie całości
|
source ./demux.sh
|
||||||
ffmpeg -y -f concat -safe 0 -i out/demuxer.txt -r $framerate -video_track_timescale $timescale -tune stillimage -vsync vfr -pix_fmt yuv420p out/video.mp4
|
source ./merge.sh
|
||||||
# ^ daję safe 0 aby przyjmowało bezwzględne ścieżki
|
|
||||||
|
|
||||||
|
|
||||||
echo łączenie video z dźwiękiem:
|
|
||||||
ffmpeg -i out/video.mp4 -i $input -ac 1 -video_track_timescale $timescale -tune stillimage out/video-and-audio.mp4
|
|
||||||
|
44
merge.sh
Executable file
44
merge.sh
Executable file
@ -0,0 +1,44 @@
|
|||||||
|
processed_intro_path=$PWD/out/intro-processed.mp4
|
||||||
|
processed_outro_path=$PWD/out/outro-processed.mp4
|
||||||
|
|
||||||
|
echo łączenie video z dźwiękiem:
|
||||||
|
ffmpeg -vaapi_device /dev/dri/renderD128 \
|
||||||
|
-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() {
|
||||||
|
ffmpeg -i "$1" \
|
||||||
|
-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
|
||||||
|
|
||||||
|
ffmpeg -f concat -safe 0 -i out/demuxer-branding.txt -c:v copy -b:a 320k "$final_output"
|
9
split.sh
Normal file
9
split.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
echo dzielimy mp3 na dwa osobne wav
|
||||||
|
ffmpeg -i $input -map_channel 0.0.0 /tmp/left.wav -map_channel 0.0.1 /tmp/right.wav
|
||||||
|
|
||||||
|
echo na dwóch wątkach generujemy surowe pliki
|
||||||
|
ffmpeg -i /tmp/left.wav -ac 1 -filter:a aresample=$aresample -map 0:a -c:a pcm_u8 -f data - >/tmp/leftraw &
|
||||||
|
ffmpeg -i /tmp/right.wav -ac 1 -filter:a aresample=$aresample -map 0:a -c:a pcm_u8 -f data - >/tmp/rightraw &
|
||||||
|
|
||||||
|
# czekamy aż obydwa wątki się zakończą
|
||||||
|
wait
|
Loading…
Reference in New Issue
Block a user