offish / twitchtube

Twitch YouTube bot. Automatically make video compilations of the most viewed Twitch clips and upload them to YouTube using Python 3.
MIT License
540 stars 77 forks source link

force video render by gpu instead of cpu #86

Open tiktoins opened 2 years ago

tiktoins commented 2 years ago

hi offish, please make changes to force video render by gpu instead of cpu waiting for your commit changes :) finest regards

offish commented 2 years ago

Not all computers who is going to run this will have a GPU. Add an option for that yourself.

ddoShubh commented 1 year ago

Not all computers who is going to run this will have a GPU. Add an option for that yourself.

Can you help me to add that option? because my gpu is far better than my cpu And love the bot it works great 👍

OwOHamper commented 1 year ago

First you would need to install ffmpeg and add it to your PATH. Afterwards you can get list of all available codes by typing ffmpeg -encoders. But you most likely want to use h264_nvenc with Nvidia GPU. When you have decided what codec you want to use you can edit the codec in video.py:

    final.write_videofile(
        f"{path}/{file_name}.mp4",
        fps=frames,
        temp_audiofile=f"{path}/temp-audio.m4a",
        remove_temp=True,
        codec="h264_nvenc", #edit this
        audio_codec="aac",
    )