357423317de4dd48fa03534bb43b9de6ef7ac68d
[hevc-pipeline.git] / hevc-pipeline.sh
1 #!/bin/bash
2 mapfile -t hevc_films < <(ssh mbp 'find /srv/deluge/Downloads/ \( -name '"'"'*.mkv'"'"' -o -name '"'"'*.mp4'"'"' \) -type f -print0| xargs -0 -P 4 -I@ bash -c '"'"'test "hevc" == $(ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "@") && echo "@"'"'"'' )
3
4 # copy all streams from input 0 except subs and annotations
5 # -map -0:s -map -0:t \
6
7 printf '%s\0' "${hevc_films[@]}" | xargs -0 -P 1 -I@ bash -c 'ssh mbp '"'"'cat "@"'"'"' |
8 ffmpeg \
9 -fflags +igndts \
10 -i - \
11 -map 0 \
12 -c:v libx264 -level:v 4.1 -tag:v avc1 \
13 -crf 23 \
14 -vf \
15 format=yuv420p \
16 -preset veryfast \
17 -c:a copy \
18 -f matroska \
19 - | \
20 ssh mbp '"'"'cat > "@".new'"'"''