1080i60=1080p60hevc(yadif zero motion blur)
ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i test.ts -c:v hevc_nvenc -tag:v hvc1 -b:v 4M -maxrate:v 6M -bufsize:v 8M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]yadif_cuda=deint=interlaced:mode=1' -c:a copy -f mp4 test-hevc-hwd-60p.mp4
ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i "../${SRC}" -pass 1 -c:v hevc_nvenc -tag:v hvc1 -b:v 4M -maxrate:v 6M -bufsize:v 8M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]yadif_cuda=deint=interlaced:mode=1' -c:a copy -f null - && ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i "../${SRC}" -pass 2 -c:v hevc_nvenc -tag:v hvc1 -b:v 4M -maxrate:v 6M -bufsize:v 8M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]yadif_cuda=deint=interlaced:mode=1' -c:a copy "../${DST}"
1080i60=1080p60hevc(software yadif zero motion blur)
ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i test.ts -c:v hevc_nvenc -tag:v hvc1 -b:v 4M -maxrate:v 6M -bufsize:v 8M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p[0v];[0v]yadif=deint=interlaced:mode=1' -c:a copy -f mp4 test-hevc-60p.mp4
ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i "../${SRC}" -pass 1 -c:v hevc_nvenc -tag:v hvc1 -b:v 4M -maxrate:v 6M -bufsize:v 8M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p[0v];[0v]yadif=deint=interlaced:mode=1' -c:a copy -f null - && ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i "../${SRC}" -pass 2 -c:v hevc_nvenc -tag:v hvc1 -b:v 4M -maxrate:v 6M -bufsize:v 8M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p[0v];[0v]yadif=deint=interlaced:mode=1' -c:a copy "../${DST}"
1080i60=1080p30hevc(software yadif 30fps)
ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i test.ts -c:v hevc_nvenc -tag:v hvc1 -b:v 4M -maxrate:v 6M -bufsize:v 8M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p[0v];[0v]yadif=deint=interlaced' -c:a copy -f mp4 test-hevc-30p.mp4
ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i "../${SRC}" -pass 1 -c:v hevc_nvenc -tag:v hvc1 -b:v 4M -maxrate:v 6M -bufsize:v 8M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p[0v];[0v]yadif=deint=interlaced' -c:a copy -f null - && ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i "../${SRC}" -pass 2 -c:v hevc_nvenc -tag:v hvc1 -b:v 4M -maxrate:v 6M -bufsize:v 8M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p[0v];[0v]yadif=deint=interlaced' -c:a copy "../${DST}"
1080i60=1080p30hevc(pullup 30fps)
ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i test.ts -c:v hevc_nvenc -tag:v hvc1 -b:v 4M -maxrate:v 6M -bufsize:v 8M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p,pullup,fps=30000/1001,setpts=N/29.97002997002997/TB' -c:a copy -f mp4 test-hevc-30p.mp4
ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i "../${SRC}" -pass 1 -c:v hevc_nvenc -tag:v hvc1 -b:v 4M -maxrate:v 6M -bufsize:v 8M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p,pullup,fps=30000/1001,setpts=N/29.97002997002997/TB' -c:a copy -f null - && ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i "../${SRC}" -pass 2 -c:v hevc_nvenc -tag:v hvc1 -b:v 4M -maxrate:v 6M -bufsize:v 8M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p,pullup,fps=30000/1001,setpts=N/29.97002997002997/TB' -c:a copy "../${DST}"
1080i60=1080p24hevc(film hw deint)
ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i test.ts -c:v hevc_nvenc -tag:v hvc1 -b:v 4M -maxrate:v 6M -bufsize:v 8M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p,pullup,fps=24000/1001,setpts=N/23.976023976023976/TB' -c:a copy -f mp4 test-hevc-24p.mp4
1080i60=1080p24hevc(software deint film)
ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i test.ts -c:v hevc_nvenc -tag:v hvc1 -b:v 4M -maxrate:v 6M -bufsize:v 8M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p,yadif=deint=interlaced,pullup,fps=24000/1001,setpts=N/23.976023976023976/TB' -c:a copy -f mp4 test-hevc-24p.mp4
ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i test.ts -c:v hevc_nvenc -tag:v hvc1 -b:v 4M -maxrate:v 6M -bufsize:v 8M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p[0v];[0v]yadif=deint=interlaced,decimate=cycle=2' -c:a copy -f mp4 test-hevc-24p.mp4
1080i60=1080i30x264(smooth)
ffmpeg -i test.ts -c:v libx264 -b:v 5M -maxrate:v 8M -bufsize:v 16M -profile:v main -preset slow -filter_complex 'format=yuv420p' -flags:v +ildct+ilme -x264opts tff=1 -c:a copy -f mp4 test-x264.mp4
ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i test.ts -c:v libx264 -b:v 6M -maxrate:v 9M -bufsize:v 16M -profile:v high -preset slow -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p' -flags:v +ildct+ilme -x264opts tff=1 -c:a copy -f mp4 test-nvdec-x264.mp4
ffmpeg -threads 1 -fflags +genpts-fastseek -hwaccel nvdec -hwaccel_output_format cuda -extra_hw_frames 3 -reinit_filter 1 -vsync 1 -async 1 -filter_threads 2 -filter_complex_threads 2 -i "../${SRC}" -pass 1 -c:v hevc_nvenc -tag:v hvc1 -b:v 2.5M -maxrate:v 3M -bufsize:v 5M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p,pullup,fps=24000/1001,setpts=N/23.976023976023976/TB' -c:a copy -f null - && ffmpeg -threads 1 -fflags +genpts-fastseek -hwaccel nvdec -hwaccel_output_format cuda -extra_hw_frames 3 -reinit_filter 1 -vsync 1 -async 1 -filter_threads 2 -filter_complex_threads 2 -i "../${SRC}" -pass 2 -c:v hevc_nvenc -tag:v hvc1 -b:v 2.5M -maxrate:v 3M -bufsize:v 5M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p,pullup,fps=24000/1001,setpts=N/23.976023976023976/TB' -c:a copy "../${DST}"
ffmpeg -threads 1 -fflags +genpts-fastseek -hwaccel nvdec -hwaccel_output_format cuda -extra_hw_frames 3 -reinit_filter 1 -vsync 1 -async 1 -filter_threads 2 -filter_complex_threads 2 -i "../${SRC}" -pass 1 -c:v hevc_nvenc -tag:v hvc1 -b:v 3M -maxrate:v 4M -bufsize:v 5M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -vf '[0:v]hwdownload,format=nv12,format=yuv420p[0v]' -c:a copy -f null - && ffmpeg -threads 1 -fflags +genpts-fastseek -hwaccel nvdec -hwaccel_output_format cuda -extra_hw_frames 3 -reinit_filter 1 -vsync 1 -async 1 -filter_threads 2 -filter_complex_threads 2 -i "../${SRC}" -pass 2 -c:v hevc_nvenc -tag:v hvc1 -b:v 3M -maxrate:v 4M -bufsize:v 5M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -vf '[0:v]hwdownload,format=nv12,format=yuv420p[0v]' -c:a copy "../${DST}"
#!/bin/bash
SRC=$1
DST=$(echo ${SRC} | sed -e 's/\.ts/\.mp4/g')
DIR=$(uuidgen)
mkdir ./${DIR}
cd ./${DIR}
ffmpeg -threads 1 -fflags +genpts-fastseek -hwaccel nvdec -hwaccel_output_format cuda -extra_hw_frames 3 -reinit_filter 1 -vsync 1 -async 1 -filter_threads 2 -filter_complex_threads 2 -i "../${SRC}" -pass 1 -c:v hevc_nvenc -tag:v hvc1 -b:v 2.5M -maxrate:v 3M -bufsize:v 5M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p,pullup,fps=24000/1001,setpts=N/23.976023976023976/TB' -c:a copy -f null - && ffmpeg -threads 1 -fflags +genpts-fastseek -hwaccel nvdec -hwaccel_output_format cuda -extra_hw_frames 3 -reinit_filter 1 -vsync 1 -async 1 -filter_threads 2 -filter_complex_threads 2 -i "../${SRC}" -pass 2 -c:v hevc_nvenc -tag:v hvc1 -b:v 2.5M -maxrate:v 3M -bufsize:v 5M -profile:v main -preset slow -rc:v vbr_hq -rc-lookahead:v 32 -spatial_aq:v 1 -aq-strength:v 15 -filter_complex '[0:v]hwdownload,format=nv12,format=yuv420p,pullup,fps=24000/1001,setpts=N/23.976023976023976/TB' -c:a copy "../${DST}"
cd ..
rm -rf ./${DIR}
Execute(4 in parallel via xargs)
find ./ -iname '*.ts' -exec echo \"{}\" \; | xargs -n 1 -P 4 ~/bin/hevc_720p24