Transcoding H265 footage to H264 for use in Vegas Pro 14?

Aron-C wrote on 11/12/2019, 12:02 PM

I'm trying to record gameplay footage using AMD's Radeon ReLive software and I want to edit it in SVP 14. I've found that using the HEVC codec leads to significantly improved quality compared to AVC, but there's a problem. When I try to import said HEVC files (with the container being .mp4) into the editing software, it just doesn't work. I've been searching all over the place for answers on how to solve this issue, and I think the solution I've found is a good way of doing it? I'm basically asking for confirmation with this post. So what I'm doing is transcoding the original footage to the H264 codec using FFmpeg. The command line code I'm using is as follows:

ffmpeg -i input.mp4 -c:v libx264 -preset veryslow -crf 10 output.mp4
  • With the 'veryslow' preset being used for the best possible compression;
  • And my bitrate set at 10, which is I guess overkill but I just want to make sure it's as close to perfect as possible, without going all the way down to -crf 0.

And after doing this, the footage loads into Vegas perfectly fine. Now, I have no idea if this is a good way of doing it, and I'm not sure if it looks better than recording directly to H264. To me it makes sense, and definitely seems like it, but it could very well be a placebo effect. I've also seen posts where people advised 'remuxing' the files so that Vegas can accept them, but I don't really understand what needs to be done there.

Thanks in advance.

 

Comments

Musicvid wrote on 11/12/2019, 12:27 PM

I've found that using the HEVC codec leads to significantly improved quality compared to AVC

Not exactly. HEVC records the same optimal quality at a lower bandwidth. It's also harder to decode.

When I try to import said HEVC files (with the container being .mp4) into the editing software, it just doesn't work.

HEVC mp4 works fine in my VP14. So the things to do for assistance are:

I'm not sure if it looks better than recording directly to H264. 

A second encode will always degrade your image due to generational loss. Recording and delivering AVC is always best and easiest on your system, unless you are recording HDR (doubtful).

And after doing this, the footage loads into Vegas perfectly fine

Now, my speculative moment. ffmpeg is defaulting your vfr source :-) to Constant Frame Rate, which is what VP14 needs to open your movie. It is better on several fronts to do it all in one step, not to mention all the extra time it is costing you. Variable Frame Rate HEVC does not open reliably in VP14.

AVC 8 bits 4:2:0 Constant Frame Rate, around CRF 18 is your "sweet spot," for Vegas, because that is what Vegas will create. Overkill is waste, and nothing more.

fifonik wrote on 11/12/2019, 2:45 PM

I'd try to remove 2nd encoding from workflow. As already mentioned it degrades quality and in addition it require time. If you can increase bitrate in your ReLive and save video with constant frame rate -- this will solve all your issues. If this is not possible in this software I'd rather try another recording software.

As for your steps, CRF=10 is a bit overkill, but to be on a safe side it is fine. If you do not want to lose quality on the intermediate re-encoding, you can always compress to lossless. UTVideo, MagicYUV lossless encoders are supported by FFMpeg. However, intermediate files will be huge in this case.

Last changed by fifonik on 11/12/2019, 2:46 PM, changed a total of 1 times.

Camcorder: Panasonic X1500 + Panasonic X920 + GoPro Hero 11 Black

Desktop: MB: MSI B450M MORTAR TITANIUM, CPU: AMD Ryzen 5700X, RAM: G'Skill 32 GB DDR4@3200, Graphics card: MSI RX6600 8GB, SSD: Samsung 970 Evo+ 1TB (NVMe, OS), HDD WD 4TB, HDD Toshiba 4TB, OS: Windows 10 Pro 22H2

NLE: Vegas Pro [Edit] 11, 12, 13, 15, 17, 18, 19, 22

Author of FFMetrics and FFBitrateViewer

Aron-C wrote on 11/12/2019, 2:53 PM

Huh, so it's the VFR that's causing the issue? ReLive does record strictly in VFR. Is there any advantage to recording in VFR compared to CFR?

Not exactly. HEVC records the same optimal quality at a lower bandwidth. It's also harder to decode.

Also, wouldn't this mean that recording with HEVC does lead to better quality at the same performance hit? And in that case it would be preferable, right? So would there be any way to use the raw HEVC file other than to record the clip itself using a CFR? I'll link 3 separate clips - one recorded directly in H264, one in H265, and the transcoded clip (this time with -crf 18). Looking at them closer, the transcoded clip pretty much seems identical to the AVC one (meaning I should just record H264 directly), but the raw HEVC one definitely looks the best to me:

H264 - https://drive.google.com/open?id=1Psml4Po4owE2OvqcjpCRgtPEeGs2E4Xx

H265 - https://drive.google.com/open?id=1qAPoOOIOgBbxS_L1o7HNM_oz8GyYrKVO

Transcoded - https://drive.google.com/open?id=1h6b5zCRIn-DNeHhtFQBWdhDrEbeHN61s

Here's the MediaInfo report by the way (of the original H265 file):

General
Complete name                            : C:\Users\User\Desktop\Usable Footage\2019.11.11-22.08.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/mp41)
File size                                : 915 MiB
Duration                                 : 1 min 42 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 75.2 Mb/s
Writing application                      : Lavf58.20.100

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L4.1@Main
Codec ID                                 : hev1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 1 min 42 s
Bit rate                                 : 74.9 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 60.000 FPS
Minimum frame rate                       : 59.796 FPS
Maximum frame rate                       : 60.015 FPS
Standard                                 : Component
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Bits/(Pixel*Frame)                       : 0.602
Stream size                              : 912 MiB (100%)
Color range                              : Limited
Codec configuration box                  : hvcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 1 min 41 s
Bit rate mode                            : Variable
Bit rate                                 : 288 kb/s
Maximum bit rate                         : 320 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                              : 3.46 MiB (0%)
Default                                  : Yes
Alternate group                          : 1

Aron-C wrote on 11/12/2019, 3:07 PM

UPDATE: I just tried recording a video using OBS Studio, using a HEVC codec at a CONSTANT frame rate. However, when I attempted to import this file into Vegas, it didn't work in the exact same way as my HEVC VFR files. I also tried switching the rate control method from VBR to CBR and that didn't work either.

MediaInfo report of this file:

General
Complete name                            : C:\Users\User\Desktop\Usable Footage\2019-11-12 22-00-07.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/mp41)
File size                                : 3.34 MiB
Duration                                 : 9 s 800 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 2 860 kb/s
Writing application                      : Lavf58.20.100

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L4.1@Main
Codec ID                                 : hev1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 9 s 800 ms
Bit rate                                 : 2 847 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 60.000 FPS
Standard                                 : Component
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Bits/(Pixel*Frame)                       : 0.023
Stream size                              : 3.33 MiB (100%)
Color range                              : Limited
Codec configuration box                  : hvcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 9 s 771 ms
Bit rate mode                            : Variable
Bit rate                                 : 2 268 b/s
Maximum bit rate                         : 320 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                              : 2.71 KiB (0%)
Title                                    : Track1
Default                                  : Yes
Alternate group                          : 1

fifonik wrote on 11/12/2019, 3:18 PM

However, when I attempted to import this file into Vegas, it didn't work in the exact same way as my HEVC VFR files.

Could you explain this bit please?

Error message? Black in preview? VP chases? Anything else?

It should work. However, I'm not sure about VP14. Will try at home your file in VP13.

Camcorder: Panasonic X1500 + Panasonic X920 + GoPro Hero 11 Black

Desktop: MB: MSI B450M MORTAR TITANIUM, CPU: AMD Ryzen 5700X, RAM: G'Skill 32 GB DDR4@3200, Graphics card: MSI RX6600 8GB, SSD: Samsung 970 Evo+ 1TB (NVMe, OS), HDD WD 4TB, HDD Toshiba 4TB, OS: Windows 10 Pro 22H2

NLE: Vegas Pro [Edit] 11, 12, 13, 15, 17, 18, 19, 22

Author of FFMetrics and FFBitrateViewer

Aron-C wrote on 11/12/2019, 3:30 PM

This:

Musicvid wrote on 11/12/2019, 3:34 PM

Whoa. Your overthinking is filling my computer room with smoke.

  • uh, so it's the VFR that's causing the issue? I don't know. Did I say "speculate?"
  • Is there any advantage to recording in VFR compared to CFR? It is a tiny bit smaller.
  • Also, wouldn't this mean that recording with HEVC does lead to better quality at the same performance hit? No. "Optimal Quality" is a CEILING. You can bump your head here, or you can bump your head there. Makes no difference. There is no Quality to be gained past Optimal, which is loosely defined for practical purpose as SSIM ~0.995. If you will please study my second illustration in detail, you will plainly see that the only thing to be gained is excessive bitrate and file size.
  • but the raw HEVC one definitely looks the best to me:​​​​​​​ Raw and HEVC are two different things. You are entitled to your subjective impressions, of course, but the physics do not support your conjecture. Going forward, we like "quantified tests" in place of "looks the best to me."
  • the transcoded clip pretty much seems identical to the AVC one. No. It is worse by default from encoding an encode. Again, run your own research, and leave the adjectives behind.
  • So would there be any way to use the raw HEVC file other than to record the clip itself using a CFR? I don't know because I haven't tested your files. But I will find out for you, probably not today. In the meantime, start your learning curve here: http:\\compression.ru

 

Aron-C wrote on 11/12/2019, 4:08 PM

Alright, yeah, apologies for that lul. So is there any actual real world advantage to recording with HEVC over AVC, or is it all in my head? Thanks for taking the time to help, by the way.

Musicvid wrote on 11/12/2019, 4:29 PM

So is there any actual real world advantage to recording with HEVC over AVC, 

There is no advantage to HEVC other than better compression. HEVC encoding / decoding is more demanding on your system. It takes a lot longer. It is of nearly identical quality (some would say ME is a bit worse). For SD, HD, and 4k 8-bit, there is little real-world advantage to using it.

HEVC is valuable for REC 2020 10+ bit HDR acquisition. It's nothing but fluff with your material.

As far as all of your questions about an encoder having better quality than another I made this so you can see what a quality vs. bitrate ceiling looks like. SSIM 1.0 means theoretical perfect quality (an exact source copy). It can't exceed that unless you party in certain parts of San Francisco. I'll check in in a week. There will be a quiz.

wwaag wrote on 11/12/2019, 5:07 PM

I'm not sure what the problem is with your system, but both the h264 and h265 can be imported into Vegas 14 here without issue and they preview at Best Full at 60 fps.

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.

fifonik wrote on 11/12/2019, 5:13 PM

In real world HEVC is better on low bitrates (streaming on limited bandwidth). May be up to 5 Mbps for FullHD. For your bitrate (70+ Mbps) I do not think someone will notice any visual difference.

Encoders implementations could be much more important as some encoders produce really poor quality. But even in this case on high bitrate they should be fine.

Camcorder: Panasonic X1500 + Panasonic X920 + GoPro Hero 11 Black

Desktop: MB: MSI B450M MORTAR TITANIUM, CPU: AMD Ryzen 5700X, RAM: G'Skill 32 GB DDR4@3200, Graphics card: MSI RX6600 8GB, SSD: Samsung 970 Evo+ 1TB (NVMe, OS), HDD WD 4TB, HDD Toshiba 4TB, OS: Windows 10 Pro 22H2

NLE: Vegas Pro [Edit] 11, 12, 13, 15, 17, 18, 19, 22

Author of FFMetrics and FFBitrateViewer

fifonik wrote on 11/12/2019, 5:15 PM

I'm not sure what the problem is with your system, but both the h264 and h265 can be imported into Vegas 14 here without issue and they preview at Best Full at 60 fps.

I also said that it should not be an issue for VP to open these files based on MediaInfo.

Camcorder: Panasonic X1500 + Panasonic X920 + GoPro Hero 11 Black

Desktop: MB: MSI B450M MORTAR TITANIUM, CPU: AMD Ryzen 5700X, RAM: G'Skill 32 GB DDR4@3200, Graphics card: MSI RX6600 8GB, SSD: Samsung 970 Evo+ 1TB (NVMe, OS), HDD WD 4TB, HDD Toshiba 4TB, OS: Windows 10 Pro 22H2

NLE: Vegas Pro [Edit] 11, 12, 13, 15, 17, 18, 19, 22

Author of FFMetrics and FFBitrateViewer

Musicvid wrote on 11/12/2019, 5:34 PM

I'm not sure what the problem is with your system, but both the h264 and h265 can be imported into Vegas 14 here without issue and they preview at Best Full at 60 fps.

Now that I'm at my PC, the same is true, except that only the h264 previews at 60fps at Best/Full. h265 is around 23fps. Says something.

 

Musicvid wrote on 11/12/2019, 5:52 PM

In real world HEVC is better on low bitrates (streaming on limited bandwidth). 

That is correct, since commercial streaming and broadcast bandwidths are already suboptimal. That's a slippery slope; we try not to play there.

BruceUSA wrote on 11/12/2019, 6:14 PM

.h265 1080 60P cut like butter here . :)

Intel i9 Core Ultra 285K Overclocked all P Cores @5.6, all E-Cores @5ghz               

MSI MEG Z890 ACE Gaming Wifi 7 10G Super Lan, thunderbolt 4                                

48GB DDR5 -8200mhz Overclocked @8800mhz                  

Crucial T705 nvme .M2 2TB Gen 5  OS. 4TB  gen 4 storage                    

RTX 5080 16GB  Overclocked 3.1ghz, Memory Bandwidth increased from 960 GB/s to 1152 GB/s                                                            

Custom built hard tube watercooling.                            

MSI PSU 1250W, Windows 11 Pro

 

Former user wrote on 11/12/2019, 6:31 PM

Alright, yeah, apologies for that lul. So is there any actual real world advantage to recording with HEVC over AVC, or is it all in my head? Thanks for taking the time to help, by the way.

It's true what you say that AMD hardware encoding done in HEVC is much superior quality to AVC, so that is the advantage. I don't think you mentioned using hardware encode, but you're using ReLIve so i'm guessing you are

Musicvid wrote on 11/12/2019, 6:57 PM

Bob, surely that is a typo, unless, as fifonik says, you are running very low streaming bitrates.

Former user wrote on 11/12/2019, 10:56 PM

I thought he was using 2700kbit/s but that was only for his OBS test. He's actually using 75MB/s and as you say should see no difference at 1080p. Where HEVC is better would be for 1440p60fps screencap'ing. The AMD HEVC encoder is more powerful and can manage that, but with AVC if it's possible at all the quality settings would be set very low. This was my experience with RX480, and unfortunately AMD AVC encoding hasn't improved since although Navi cards may with firmware upgrade

fifonik wrote on 11/13/2019, 1:57 AM

I was able to open both files in VP15 and VP17(VP17 started to activate codec as it was recently installed and I have not worked with HEVC in it yet).

However, VP13 was only able to open 264. Not 265.

I do not have VP14 to check.

Camcorder: Panasonic X1500 + Panasonic X920 + GoPro Hero 11 Black

Desktop: MB: MSI B450M MORTAR TITANIUM, CPU: AMD Ryzen 5700X, RAM: G'Skill 32 GB DDR4@3200, Graphics card: MSI RX6600 8GB, SSD: Samsung 970 Evo+ 1TB (NVMe, OS), HDD WD 4TB, HDD Toshiba 4TB, OS: Windows 10 Pro 22H2

NLE: Vegas Pro [Edit] 11, 12, 13, 15, 17, 18, 19, 22

Author of FFMetrics and FFBitrateViewer

Aron-C wrote on 11/13/2019, 6:58 AM

If the VFR file is working for others, then I guess it's something hardware-related on my part? So if there isn't any actual noticeable difference between 1080p recordings with H265 vs. H264, should I just stick with recording H264 directly?

Musicvid wrote on 11/13/2019, 8:48 AM

Does your capture program have software encoder choices, like x264? You would be happier all the way around, except maybe for encoding speed.

If you must use hardware encoders, keep the bitrate nice and high, as you did with h265. Are your only h264 options hardware? I completely missed that from your first posts.

With apologies also to @Former user, I have said several times I think that hardware encoders in general are pretty mediocre. And others have reminded me that some on-card GPUS are pretty good, so I will step out and leave the discussion of AMD h265 vs AMD h264 at suboptimal bitrates to others who know more about it than me. General advice stands.

Meanwhile, a lot of our users like OBS because it encodes with x264 software, which is really, really good, and slower.

https://www.vegascreativesoftware.info/us/forum/faq-what-obs-studio-settings-work-well-with-vegas-pro--109925/

Aron-C wrote on 11/13/2019, 1:06 PM

Yeah, ReLive doesn't have encoder options other than AVC and HEVC. I've tried using OBS, but for some reason my computer really struggles when recording at the same settings using OBS vs. ReLive. Thing is, when I'm recording the game you saw in those files with OBS, whenever I aim down sights using a magnified scope and (I guess) it puts more strain on my PC, the footage starts to lag a lot. The only time it doesn't lag is when I'm recording using the 'x264 low cpu usage preset' encoder at the 'High' quality preset. Could it be that my CPU is to blame? But I also don't understand how when recording with ReLive, the footage looks perfectly smooth, but when recording with OBS at the same settings (75 Mbps with the hardware encoder) it lags during more strenuous tasks (such as rendering at further distances).

Musicvid wrote on 11/13/2019, 6:07 PM

Could it be that my CPU is to blame?

Yes, it could be, but I can't find where you've posted your system specs.

Aron-C wrote on 11/14/2019, 4:19 AM

Here's my specs:

AMD Radeon RX 570 8GB;

AMD FX-8320 Octacore CPU (3.5 GHz);

2x 8GB HyperX Fury DDR3 RAM;

Seagate Barracuda 1TB 7.2K RPM HDD (Recording HDD);

Western-Digital Caviar Green 1TB 5.4K RPM;

Samsung 860 EVO 500GB SSD