H264 encode initial frame info incorrect

  • It's taken me a while to figure out and get clarity on this and the issue has been in Vouk "forever". Only Pegasys TMPGEnc Smart Render actually complains but since I use this tool all the time for render-less quick edits of an encoded stream, it's a problem.

    TMPGEnc has a "smart render" feature, i.e. if the tool sees edits on i-frame boundaries, it does a lossless edit. BUT for H.264 video produced by Premiere plug (NVENC or ffmpeg/x264), where the first video frame is used, it always does a re-render. The issue appears to be that the framing sequence is "I-I- ... and then regular B and P". If that first frame is removed, all works fine. I don't understand why it always seems to want to start with I-I, but other tools don't do that - std IBBP ... etc. The response from Pegasys as to why it reencodes is:

    "The reason of smart rendering of your source file "Sequence 1080p 29.97.mp4"
    is time stamp information. Your file should have to start from Frame
    no.1 not 0. The first frame is added and it is a copy of the first frame
    of the video. If you cut the first frame in Cut edit screen, the file
    won't be re-encoded. You can check again in the Smart rendering analyzer."

    Be great if this could be fixed/changed.

  • A bit more info on this. It is NVENC only and also can be produced directly using FFMEG so I guess the problem is with them. That 1st frame also has no audio. No idea if Vouk can "get around the problem" by just not writing the 1st frame :)

  • I've done plenty of TMPGEnc disc work with NVENC renders from Vegas/Voukoder/VoukoderPro/FFmpeg, and have never seen this. If FFmpeg itself was introducing errors, you'd think I'd have had this problem too... Which makes me wonder whether your issue might be with Premiere or the settings there-in? Or maybe even your I/B-frame settings in Voukoder/FFmpeg? Just my 2 cents.

    23 Mal editiert, zuletzt von Joe24 (7. November 2023 um 23:47)

  • Hah! TMPGEnc Smart Render DOES accept and process the fields, it's just that the 1st x frames gets re-rendered. Video Authoring Works accepts it, no idea what it actually does recoding wise in building the disk. Here is how I actually realized something was wrong.

    1) create BluRay complaint 1080p stream, with "1 sec" GOP (30 frame) for std 29.97 video.

    2) bring up SmartRender, add the clip, then in the "Format" panel click "Start Analysis". Notice it wants to render the first 2 sec. Now output the file and it creates a 61 frame GOP out of the original 3 GOPs (1, 30, 30).

    3) This re-rendered file is now not BluRay compliant.

    (don't ask or go there regarding WHY SmartRender does what it does, it bitches and showed up the error).

    So unless you're going down this path you wouldn't have noticed the issue. BUT if you bring up a Vouk or FFMpeg NVENC clip in SmartRender, enable "show frame status", you'll see the solitary I frame followed by the regular GOPs ... and a blank audio frame.

  • Not sure if this has any bearing on the issue, but the 1080p29.97 h.264 format itself is not Blu-ray compliant.

    1080i29.97, 1080p24, and 1080p23.976 are Blu-ray compliant in h.264.

    You can also do 1080p29.97 HEVC on UltraHD Blu-ray.

    List of Blu-ray compatible formats (see the Data Format Standards subheading):

    Blu-ray - Wikipedia
    en.m.wikipedia.org

    23 Mal editiert, zuletzt von Joe24 (8. November 2023 um 06:40)

  • LOL, yep x264 lets you do "fake interlace" and TMPGEnc Authoring works does a wink/nod with 1080p. I author a lot of BluRay every year and used to do DVD. Each disk authoring package has their quirks on what they allow at or around the standard.

    I may eventually bite the bullet and include UHD in my work flow but don't want to burn the $$.

  • Yes SmartRender does it's annoying correction to all FFMpeg/NVENC generated files. BUT the real issue is that FFMpeg is starting the encode sequence with that bogus/duplicate frame, which is wrong. It's an FFMpeg bug which makes it a problem for us using Vouk.

  • I just finished a project with x264 encoding and YES the 1st frame issue is here too. Just to sure it's not something I did, I did a quick encode with the x264 default "4:2:0 General Purpose 8-bit.." and it's there too. Therefore I assume Daniel can reproduce it ... and it really is an FFMpeg problem.

  • 1) create BluRay complaint 1080p stream, with "1 sec" GOP (30 frame) for std 29.97 video.

    2) bring up SmartRender, add the clip, then in the "Format" panel click "Start Analysis". Notice it wants to render the first 2 sec. Now output the file and it creates a 61 frame GOP out of the original 3 GOPs (1, 30, 30).

    3) This re-rendered file is now not BluRay compliant.

    [...]

    if you bring up a Vouk or FFMpeg NVENC clip in SmartRender, enable "show frame status", you'll see the solitary I frame followed by the regular GOPs ... and a blank audio frame.


    I don't observe any frame-order problems with video files rendered by Vegas 20 using Voukoder/VoPro. Following the steps quoted above (except using GOP 60, which is actually the Blu-ray max for 29.97p video, and my preferred setting), the first few frames of the video are as follows, starting with frame 0: IBPBP.

    Switching to your setting of GOP 30, Smart Renderer now wants to re-encode most of the video file for whatever reason (see screenshot). But the frames still remain in the correct order (IBPBP), with no extra I-frame. I assume you have a reason for rendering as GOP 30, so I'm not going to address that.

    Tested some 1080p23.976 GOP 48 renders, and they cause no problems either.

    I suspect, as stated before, that your problem may lie with Premiere or your settings therein. AFAIK, FFmpeg just encodes whatever frames it's fed.

    See screenshots below. TMPGEnc Smart Renderer 6 doesn't complain about the video stream at all using GOP 60.

    These files were encoded using Vegas Pro 20 build 411, Voukoder 13.3, connector 1.7.1, NVENC h.264. I modified a preset I normally use for Blu-ray encoding, just changing frame rate and GOP size. Normally I run 1080p23.976 GOP 48 which is fully Blu-ray-compatible.


    GOP 60:


    GOP 30:

    23 Mal editiert, zuletzt von Joe24 (18. November 2023 um 01:05)

  • Technically, a 1-sec GOP would be encoder Level 4.1, but changing encoder levels didn't make a difference to the results above.

    I've never had great luck with TMPGEnc Authoring Works accepting video which uses encoder Level 4.1. They say it's Blu-ray compatible, but I never found how to make it work. AW always flags the 4.1 tracks as incompatible with Blu-ray, by reason of encoder level. So I just use encoder Level 4.0, which works fine. TMPGEnc Authoring Works accepts either 1-sec or 2-sec GOPs with Level 4.0 (which should be 2-sec GOP only, according to spec).

    Lol, and as mentioned . . . TECHNICALLY, 1080p29.97 is non-compliant with Blu-ray anyway.

    In any case, all test files above were rendered using Voukoder, and therefore FFmpeg. And they all used NVENC on an Ampere card. None of my tests yielded a file with an extra leading I-frame, so this is quite clearly neither an FFmpeg issue, nor an NVENC issue.

    can be produced directly using FFMEG

    If you are getting this problem even while using command-line FFmpeg, then we can also rule out Voukoder and its connector as the cause.

    If the error occurs in command-line FFmpeg across multiple framerates and encoders (you've mentioned both NVENC and x264), then there must be a problem with your encoding settings, or maybe even with your source file's encoding from Premiere.

    Out of curiosity, what are your Voukoder encode settings? And what exact command-line are you using for your FFmpeg encode?

    23 Mal editiert, zuletzt von Joe24 (19. November 2023 um 12:03)