MKVs muxed MP4s render slow and not using GPU. How to MKVs into MP4s?

Miles-Thatch wrote on 11/8/2020, 7:40 PM

Hey everybody. Thanks for popping in to see this question.

I'm wondering, when converting mkv to mp4 (captured with OBS), what FFmpeg or Adobe Media Encoder (or other software) settings would you recommend I use to make sure I don't end up losing any quality AND make the MP4 file GPU render compatible?

I have tried doing the remux using VLC as well as OBS remux tools but the resulting file doesn't seem to be GPU rendering supported. Even though I do get an mp4 file out of the remux process, there is something wrong with it that makes my renders slow and not use any gpu power at all. This is true for both experimental MKV playback in Vegas AND remuxed MP4's I get from OBS remuxer and VLC remuxer. Something about remuxing that just doesn't do it quite all the way to be GPU render compatible.

I recently got an RTX 3070 for 3D, rendering and capturing and it seems like it renders my projects just as fast as my old RX 570 did. From the looks of the task manager it seems like my GPU is sitting at around 5% so I'm pretty sure it's not being utilized whatsoever. I'm using the HEV NVENC render preset. There is however a momentary spike right in the beginning of video rendering and that's exactly the place where I see the preview of my intro video clip, which I had rendered from After Effects into an MP4 format. So that intro clip seems to be rendering just fine using GPU (I see the gpu performance spike in the task manager) So my guess is that the intro clip uses an encoding method that is GPU renderer friendly, but the rest of my footage, which we capture in MKV (for crash and corruption prevention safety sake) is being rendered on the CPU only. We get footage in between 60 to 80 GB for 5-7 hours worth of recording in one take. What can I use to convert that footage to something that is GPU rendering compatible, that allows Vegas to to take advantage of my Hardware?

Vegas Pro 17.0 (license)

Ryzen7 3800x

32Gb DDR4

RTX3070

Comments

lenard wrote on 11/8/2020, 9:55 PM

When I have loaded OBS mkv's into Vegas, mostly they work, but occasionally they don't, and they will render at around 2fps or slower. I'm pretty certain I was able to fix that bug by muxing to mp4. If you're talking about slow render other than 2fps or similar then that's not the issue I"M familiar with

Miles-Thatch wrote on 11/8/2020, 10:44 PM

When I have loaded OBS mkv's into Vegas, mostly they work, but occasionally they don't, and they will render at around 2fps or slower. I'm pretty certain I was able to fix that bug by muxing to mp4. If you're talking about slow render other than 2fps or similar then that's not the issue I"M familiar with

I think you may not have read past the title. Since:

I have tried doing the remux using VLC as well as OBS remux tools but the resulting file doesn't seem to be GPU rendering supported. Even though I do get an mp4 file out of the remux process, there is something wrong with it that makes my renders slow and not use any gpu power at all. This is true for both experimental MKV playback in Vegas AND remuxed MP4's I get from OBS remuxer and VLC remuxer. Something about remuxing that just doesn't do it quite all the way to be GPU render compatible.

is literally my 2nd paragraph.

lenard wrote on 11/8/2020, 10:49 PM

You still didn't say, is your slow render speed 2fps or slower, or is it something else. If it's something else, I'm not familiar with the problem. Is OBS encoding in CFR or VFR it is said VFR causes slow down

wwaag wrote on 11/8/2020, 11:09 PM

It's a common problem that whenever you remux an MKV to MP4 file, it changes from CFR to VFR, even if the original file is CFR. Just google "mkv to mp4 variable frame rate". You'll see lots of complaints--some referencing Vegas. The default when rewrapping MKV to MP4 using the Import Assist tool in HOS, is to automatically convert to CFR following the basic remux. A better solution--don't record to MKV using OBS if at all possible.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

Miles-Thatch wrote on 11/8/2020, 11:10 PM

You still didn't say, is your slow render speed 2fps or slower, or is it something else. If it's something else, I'm not familiar with the problem. Is OBS encoding in CFR or VFR it is said VFR causes slow down

It's not at 2fps, a bit faster that that, it processes in bursts of maybe 3 - 8 frames every half a second. Think it varies by CPU. OBS is set to record at CBR (Constant Bit Rate)

Miles-Thatch wrote on 11/8/2020, 11:11 PM

It's a common problem that whenever you remux an MKV to MP4 file, it changes from CFR to VFR, even if the original file is CFR. Just google "mkv to mp4 variable frame rate". You'll see lots of complaints--some referencing Vegas. The default when rewrapping MKV to MP4 using the Import Assist tool in HOS, is to automatically convert to CFR following the basic remux. A better solution--don't record to MKV using OBS if at all possible.

Besides MKV, is there anything else that can offer protection from corrupted files due to sudden recording failures like power outages or OBS outright crashing? That's why we use MKV. We've lost a good share of amazong moments due to corrupted files.

Miles-Thatch wrote on 11/8/2020, 11:14 PM

Wait a minute. HOS import assist can help with this problem too?

lenard wrote on 11/8/2020, 11:22 PM

I get 160fps with 1080p OBS mp4, remuxed from mkv. That doesn't seem slow to me. Maybe cpu load is a bit high and would be less if I wasn't encoding OBS, but I don't have a powerful CPU. Not seeing the problem myself

wwaag wrote on 11/9/2020, 12:32 PM

@Miles-Thatch It may or may not have much of an effect, but it's certainly worth a try and will be a lot quicker importing MKV's rather than messing with an external demuxer. Here's a screen grab.

Regarding render speed, you should also try Render+ which supports Nvenc renders using a dedicated rendering app. Again, you may or may not see a speed increase. Depending on the filters that you are adding on the timeline, render performance should be much, much greater than just a couple of frames a second and more in line with what @lenardhas reported.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

Miles-Thatch wrote on 11/9/2020, 2:56 PM

@Miles-Thatch It may or may not have much of an effect, but it's certainly worth a try and will be a lot quicker importing MKV's rather than messing with an external demuxer. Here's a screen grab.

Regarding render speed, you should also try Render+ which supports Nvenc renders using a dedicated rendering app. Again, you may or may not see a speed increase. Depending on the filters that you are adding on the timeline, render performance should be much, much greater than just a couple of frames a second and more in line with what @lenardhas reported.

Render speed aside, does this plugin end up creating a re-wrapped double of the video? Currently I end up with an 80GB original and then an 80GB muxed file, eating double the space.

 

The most important observation is that Vegas renders my animated intro clip at lighting fast speeds and I see my GPU usage spiking in the task manager. So I KNOW it can render videos on my hardware lighting fast. It's only when it gets to the OBS footage when it grinds down to a screeching turtle pace in comparison. So how about for a moment forget remuxing (I'll test out the Happy Otter Scripts solution on my next edit).

What about actually converting the footage? Currently after muxing with VLC, OBS or FFmpeg, I am already ending up with double the hard drive space spent. What would you recommend I use to fully convert my videos into a format that IS GPU friendly?

wwaag wrote on 11/9/2020, 3:18 PM

I'd suggest that you upload a short sample of your original MKV footage before remuxing for testing.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

JN- wrote on 11/9/2020, 4:16 PM

@Miles-Thatch You can try the vfr2cfr util, see my profile for download link. A sample would be good to test all right, what is your final export fps requirement.

---------------------------------------------

VFR2CFR, Variable frame rate to Constant frame rate link to zip here.

Copies Video Converts Audio to AAC, link to zip here.

Convert 2 Lossless, link to ZIP here.

Convert Odd 2 Even (frame size), link to ZIP here

Benchmarking Continued thread + link to zip here

Codec Render Quality tables zip

---------------------------------------------

PC ... Corsair case, own build ...

CPU .. i9 9900K, iGpu UHD 630

Memory .. 32GB DDR4

Graphics card .. MSI RTX 2080 ti

Graphics driver .. latest studio

PSU .. Corsair 850i

Mboard .. Asus Z390 Code

 

Laptop… XMG

i9-11900k, iGpu n/a

Memory 64GB DDR4

Graphics card … Laptop RTX 3080

john_dennis wrote on 11/9/2020, 6:04 PM

Two observations from Diogenes:

1) This thread has been going for almost 24 hours and @Miles-Thatch has not posted a Mediainfo report or a sample for the media that's causing all this consternation. He appears to be looking for a liberal arts solution to a technical problem.

2) Everything that @wwaag said is true and here's the staff work that supplies some proof:

Now, here's the file that I remuxed using Happy Otter Scripts / Import Assist:

General
Complete name                            : E:\OBS Captures\2020-11-09 15-37-25-Rewrapped with HOS.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 146 MiB
Duration                                 : 2 min 12 s
Overall bit rate                         : 9 239 kb/s
Tagged date                              : UTC 2020-11-09 23:49:09
Writing application                      : Lavf58.45.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High 4:4:4 Predictive@L4.2
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 2 min 12 s
Bit rate                                 : 9 121 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 59.940 (60000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:4:4
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.073
Stream size                              : 144 MiB (99%)
Writing library                          : x264 core 157 r2945 72db437
Encoding settings                        : cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x1:0x111 / me=hex 
/ subme=2 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=0 
/ cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=6 / threads=18 / lookahead_threads=6 
/ sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 
/ b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=250 
/ keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=10 / rc=crf / mbtree=1 / crf=16.0 / qcomp=0.60 
/ qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Tagged date                              : UTC 2020-11-09 23:49:09
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 2 min 12 s
Bit rate mode                            : Constant
Bit rate                                 : 102 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 1.62 MiB (1%)
Title                                    : simple_aac_recording
Default                                  : Yes
Alternate group                          : 1
Tagged date                              : UTC 2020-11-09 23:49:09

 

wwaag wrote on 11/9/2020, 6:27 PM

Just did some short rendering tests using an OBS recording saved to an MKV container in V18. The saved FHD clip was roughly five minutes (5:06) of a previously rendered video file. OBS recorded at 60 fps using Nvenc with quality set at Indistinguishable. All renders used Nvenc--Vegas being set to its default setting and HOS also set to default. Note that they are not exactly the same since Vegas only supports rate control measures (VBR, CBR) whereas HOS supports quality presets (medium with crf of 23 was used).

First, direct import of MKV into Vegas:

Vegas: Time: 4:35 with fps 66.53.
HOS: Time 3:25 with fps of 89.39

Second, import of MKV remuxed into an MP4 container (no vfr to cfr)

Vegas: Time 4:13 with fps of 72.57
HOS: Time 2.58 with fps of 102.87

Finally, import of MKV remuxed into MP4 with vfr to cfr conversion.

Vegas: Time 4:16 with fps of 71.58
HOS: Time 2.58 with fps of 103.18.

Of interest for whatever reason was that CPU usage in Vegas renders was much higher (21-25% vs %7-9%).

Note that all tests were done using an i7-8750K with an Nvidia 1050ti video card.

The bottom line seems to be that remuxing to an mp4 container improved render speed in both Vegas and HOS. However, the addition of conversion to cfr in HOS had no effect. Even though HOS was faster, Vegas render speed was near real-time.

Added:

Just did a Vegas direct encode in V17 which dropped to 4:11 from 4:35 in V18.

Last changed by wwaag on 11/9/2020, 6:40 PM, changed a total of 1 times.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

lenard wrote on 11/9/2020, 6:35 PM

I only encoded at 30fps and only at 1080p, this produced a remuxed mp4 with following timings

Frame rate mode                          : Variable
Frame rate                               : 30.000 FPS
Minimum frame rate                       : 29.412 FPS
Maximum frame rate                       : 30.303 FPS

So I have 0.9fps variability which doesn't slow encodes but maybe using an extra 10% cpu or so, @Miles-Thatch post your media info, maybe at high fps and resolutions you are getting large range of fps encoding using OBS and that is causing your slow down. Just an idea

 

Miles-Thatch wrote on 11/9/2020, 7:25 PM

This is the file info of a sample video. I will have to wait for my current render to finish before testing out HOS import method. Will post results once that is done.

 

General
Unique ID                                : 197259562710376649826315379698361190458 (0x9466CF534057BBB74D3AF3140E78483A)
Complete name                            : C:\Users\RTAG_capture_2\Videos\RTAG_recordings\2020-11-09 20-10-15.mkv
Format                                   : Matroska
Format version                           : Version 4
File size                                : 13.0 MiB
Duration                                 : 2 s 817 ms
Overall bit rate                         : 38.6 Mb/s
Writing application                      : Lavf58.29.100
Writing library                          : Lavf58.29.100
ErrorDetectionType                       : Per level 1

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Baseline@L4.2
Format settings                          : 1 Ref Frames
Format settings, CABAC                   : No
Format settings, Reference frames        : 1 frame
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 2 s 817 ms
Bit rate                                 : 40.0 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 60.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.322
Stream size                              : 13.4 MiB
Writing library                          : x264 core 157 r2945 72db437
Encoding settings                        : cabac=0 / ref=1 / deblock=0:0:0 / analyse=0:0 / me=dia / subme=0 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=250 / keyint_min=25 / scenecut=0 / intra_refresh=0 / rc_lookahead=0 / rc=cbr / mbtree=0 / bitrate=40000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=40000 / vbv_bufsize=40000 / nal_hrd=none / filler=1 / ip_ratio=1.40 / aq=0
Default                                  : Yes
Forced                                   : No

Audio #1
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : A_AAC-2
Duration                                 : 2 s 786 ms
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Title                                    : Track1
Default                                  : Yes
Forced                                   : No

Audio #2
ID                                       : 3
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : A_AAC-2
Duration                                 : 2 s 786 ms
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Title                                    : Track2
Default                                  : Yes
Forced                                   : No

Audio #3
ID                                       : 4
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : A_AAC-2
Duration                                 : 2 s 786 ms
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Title                                    : Track3
Default                                  : Yes
Forced                                   : No

Miles-Thatch wrote on 11/11/2020, 1:36 PM

@wwaag 

Alright. I've attempted to use Import assist tool but it said it was unable to decode the video. So transcoding is probably the way to go. Would you have any advice on tool / settings to use to convert the files to keep quality deterioration to a minimum?

 

I've never been able to set transcoding settings to an acceptable result. If the original footage was recorded at 40kbps, would setting the encoder bitrate to the same one yield minimal degradation? Got an 80 videogb file so wanted to confirm before I commit to this.

Miles-Thatch wrote on 11/11/2020, 2:31 PM

Here is a sample of the OBS recording from the same machine and same recording settings I record the large videos on. I've also posted the preset screenshot above with the settings if that helps.

https://drive.google.com/file/d/19PFalgFVi1laebLd2ZA6gkFA6SjFIxfN/view?usp=sharing

wwaag wrote on 11/11/2020, 2:43 PM

Works OK here. Imports OK into Vegas although only one channel of audio and works OK using ImportAssist which adds all 3 audio tracks. I'd suggest a much longer clip than 1 sec.

 

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

lenard wrote on 11/11/2020, 8:07 PM

Here is a sample of the OBS recording from the same machine and same recording settings I record the large videos on. I've also posted the preset screenshot above with the settings if that helps.

https://drive.google.com/file/d/19PFalgFVi1laebLd2ZA6gkFA6SjFIxfN/view?usp=sharing

It looks it's an mkv, who's extension you've manually changed to .mp4, Why are you doing that?