write script to quickly re-encode videos from youtube inti H264 MP4 using VAAPI

This commit is contained in:
mykola2312 2024-09-19 12:02:31 +03:00
parent a34468cb62
commit a3173f90b0
2 changed files with 20 additions and 0 deletions

View file

@ -32,6 +32,7 @@ files=(
"/usr/local/bin/scap:scap"
"$HOME/docker.sh:docker.sh"
"/usr/local/etc/X11/xinit/xinitrc.d/10-i3wm-kde-dark:X11/10-i3wm-kde-dark"
"$HOME/Videos/ffmpeg.sh:ffmpeg.sh"
)
# create directories

19
ffmpeg.sh Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
input="$1"
output="$2"
vaapi_device="/dev/dri/renderD128"
vaapi_codec="h264_vaapi"
ffmpeg \
-init_hw_device vaapi=foo:$vaapi_device \
-hwaccel vaapi \
-hwaccel_output_format vaapi \
-hwaccel_device foo \
-i "$input" \
-filter_hw_device foo \
-vf 'format=nv12|vaapi,hwupload' \
-threads 4 \
-c:v "$vaapi_codec" \
-c:a aac \
"$output"