Skip to content

Instantly share code, notes, and snippets.

@sgqy
Created March 25, 2020 23:30
Show Gist options
  • Save sgqy/055a958f99e2f704c12dbb47dcf63a72 to your computer and use it in GitHub Desktop.
Save sgqy/055a958f99e2f704c12dbb47dcf63a72 to your computer and use it in GitHub Desktop.
#!/bin/bash
find -L -iname '*.mkv' -print0 | sort -z | \
xargs -0 -i sh -c ' /usr/bin/echo -ne "\e[1;33m" && echo "$1" | tee -a /dev/shm/conv-log && /usr/bin/echo -ne "\e[0m" && \
~/lab/ffmpeg-cuda/ffmpeg/ffmpeg -y -hide_banner -loglevel level+warning -stats \
-i "$1" -map 0 -c copy \
-c:a libopus -b:a 128k -c:v hevc_nvenc -cq:v 35 o.mkv \
&& mv o.mkv "$1" ' -- {}
find -L -iname '*.mp4' -print0 | sort -z | sed -z 's/\.mp4$//g' | \
xargs -0 -i sh -c ' /usr/bin/echo -ne "\e[1;33m" && echo "$1.mp4" | tee -a /dev/shm/conv-log && /usr/bin/echo -ne "\e[0m" && \
~/lab/ffmpeg-cuda/ffmpeg/ffmpeg -y -hide_banner -loglevel level+warning -stats \
-i "$1.mp4" -map 0 -c copy \
-c:a libopus -b:a 128k -c:v hevc_nvenc -cq:v 35 "$1.mkv" \
&& rm "$1.mp4" ' -- {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment