MrDeepFakes Forums

Some content may not be available to Guests. Consider registering an account to enjoy unrestricted access to guides, support and tools

  • We are looking for community members who are intested in helping out. See our HELP WANTED post.

Convert WEBM to MP4 with ffmpeg and GPU?

JamesL

DF Vagrant
I found that handy batch file for converting WEBM files to mp4 included with splitvr2.0.  I'm new to using ffmpeg  and it took me a while to figure out how to get the batch file to work since it's not a part of deepfacelab.  I finally got it to convert a vr webm file but when it was done the file wouldn't open (I think it's just too big to play on my PC since it's 7680x7680. I can't even load it into Davinci Resolve.  
My graphics card is a GTX 1660 ti.   I could try converting it smaller but the problem is ffmpeg is using my CPU and it takes forever and slows my computer down to a crawl.

When deepfacelab uses ffmpeg does it use the CPU or is it programmed to use the GPU?   If it uses the GPU then how can I get this batch file to also do that? Is there a bit of code I need to add to integrate it into the deepfacelab apps?

@echo on
REM Convert WEBM to MP4
ffmpeg -i in.webm out.mp4
@pause
 

GolemXIV

DF Vagrant
ffmpeg is CPU only. Maybe use avidemux to convert or resize in the first place. There you have the option to "prioritize" process to below-normal (after starting in progress box).
 

coveredinnormal

DF Vagrant
if you just remove the .WEBM and replace it with .mp4 instead, it works just fine. I was able to extract images with no issues doing it that way. One less step is always better.
 

andax

DF Vagrant
ffmpeg is not cpu only.

To downscale a 8k webm video to 1440p and transcode it to h264 mp4 using Nvidia GPU:

ffmpeg -theads 4 -vsync 0 -hwaccel cuvid -i INPUT.WEBM -vf scale=-1:1440 -vcodec h264_nvenc -rc:v vbr_hq -cq:v 20 -b:v 20000k -maxrate:v 30000k OUT.MP4 -c:a libfdk_aac -b:a 128k -y

The settings are fine for 1440p VR, just adjust the thread count as needed.

Tested it on linux only but should be the same on windows as well. You will need a version compiled with the --enable-nvenc option for it to work.

Your other option on windows is using Handbrake. Go to preferences -> Video and tick the checkmark near "NVENC".
It will use the GPU at least for the encoding part.

DFL doesn't use the GPU when running ffmpeg for a good reason, but it has nothing to do with your batch file.

You can modify the file using the ffmpeg command above.

However, for frame extraction, you can just rename data_src.webm to data_src.mp4 and it will work just fine, since the input format is autodetected, not based on filename.
 
Top