44 lines
1.3 KiB
Bash
44 lines
1.3 KiB
Bash
|
#!/bin/bash
|
||
|
tmp_dir=$1
|
||
|
audio_left=$2
|
||
|
audio_right=$3
|
||
|
both_image=$4
|
||
|
none_image=$5
|
||
|
left_image=$6
|
||
|
right_image=$7
|
||
|
aresample=$8
|
||
|
echo "tmp_dir: $1";
|
||
|
echo "audio_left: $2";
|
||
|
echo "audio_right: $3";
|
||
|
echo "both_image: $4";
|
||
|
echo "none_image: $5";
|
||
|
echo "left_image: $6";
|
||
|
echo "right_image: $7";
|
||
|
|
||
|
echo "aresample: $8";
|
||
|
|
||
|
echo "dzielimy mp3 na dwa osobne wav"
|
||
|
ffmpeg -i $audio_left -map_channel 0.0.0 $tmp_dir/left.wav -map_channel 0.0.1 $tmp_dir/right.wav
|
||
|
|
||
|
echo "na dwóch wątkach generujemy surowe pliki"
|
||
|
ffmpeg -i $tmp_dir/left.wav -ac 1 -filter:a aresample=$aresample -map 0:a -c:a pcm_u8 -f data - > $tmp_dir/leftraw &
|
||
|
ffmpeg -i $tmp_dir/right.wav -ac 1 -filter:a aresample=$aresample -map 0:a -c:a pcm_u8 -f data - > $tmp_dir/rightraw &
|
||
|
|
||
|
# czekamy aż obydwa wątki się zakończą
|
||
|
wait;
|
||
|
|
||
|
echo "generating the demuxers...";
|
||
|
|
||
|
# generuje ścieżki do złożenia przez ffmpega:
|
||
|
mkdir -p ./out
|
||
|
ts-node generate-demuxer.ts --tmp_dir=$tmp_dir > ./out/demuxer.txt
|
||
|
|
||
|
|
||
|
echo "generowanie całości"
|
||
|
ffmpeg -y -f concat -safe 0 -i ./out/demuxer.txt -r 30 -tune stillimage -vsync vfr -pix_fmt yuv420p ./out/video.mp4
|
||
|
# ^ daję safe 0 aby przyjmowało bezwzględne ścieżki
|
||
|
|
||
|
|
||
|
echo "łączenie video z dźwiękiem:"
|
||
|
ffmpeg -i ./out/video.mp4 -i $audio_left -ac 1 -tune stillimage ./out/video-and-audio.mp4
|