Skip to content

Instantly share code, notes, and snippets.

@baskeboler
Last active November 29, 2021 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baskeboler/3538b61a0d4319c26d9ad291cc0d8b37 to your computer and use it in GitHub Desktop.
Save baskeboler/3538b61a0d4319c26d9ad291cc0d8b37 to your computer and use it in GitHub Desktop.
Generate karaoke video with looping background animation, audio track and ASS subtitles
#!/usr/bin/env fish
# variant of the script making use of hw acceleration with nvidia gpu
set progname "generate_karaoke_vid_nvenc.fish";
set audio_file $argv[1];
set ass_file $argv[2];
set bg_animation_file $argv[3];
set output_file $argv[4];
function help
echo "usage: $progname <audio> <ass> <background video> <output>"
end
function generate
ffmpeg -y -hwaccel cuda -stream_loop -1 -an -i $bg_animation_file -i $audio_file -acodec copy -vf ass=$ass_file -c:v nvenc -crf 28 -shortest $output_file
end
generate
or help
#!/usr/bin/env fish
set progname "generate_karaoke_vid.fish";
set audio_file $argv[1];
set ass_file $argv[2];
set bg_animation_file $argv[3];
set output_file $argv[4];
function help
echo "usage: $progname <audio> <ass> <background video> <output>"
end
function generate
# ffmpeg -y -stream_loop -1 -an -i $bg_animation_file -i $audio_file -acodec copy -vf ass=$ass_file -c:v libx265 -shortest $output_file
ffmpeg -y -stream_loop -1 -an -i $bg_animation_file -i $audio_file -acodec copy -vf ass=$ass_file -c:v libx264 -tune animation -crf 28 -shortest $output_file
end
generate
or help
@baskeboler
Copy link
Author

added a modified version of the script that makes use of hw acceleration for nvidia gpus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment