Unable to deinterlace on encode to 50p, and bwdif filter setting bug

  • I have a project which is 25i in Premiere CC2019 which I want to render out as 50 fps bwdif deinterlaced (for better temporal quality). I am NOT interpreting my footage in Premiere, everything is interlaced on the timeline.


    At export, I set my Export settings to 50p, and using Voukoder 4.1 I want to encode as deinterlaced 50p using the bwdif filter.


    I expected the process to be:

    1. set the Premiere Export video settings as 50p progressive
    2. in Voukoder -> Video -> Filters, choose bwdif, set the parameters deint=all, mode=send_field,parity=auto (the source footage is TFF).
    3. Encode a 50 fps file.

    However, doing this, I get a file which is encoded as 50p, but each video frame is doubled (like a PsF file), so it's double the duration of the audio. There is also 'flutter' at the top of the screen, an indication the deinterlacing is not being done correctly.


    Unsurpsigingly, a 2x playback rate shows the video at correct speed, albeit with frame flutter at the top of the image. I can see the field jumps from bad interpolation if I step through frame by frame. The same happens if I enable the Yadif filter. It does not happen if I use ffmpeg to bwdif deinterlace to 50p using frameserving.


    If I change my Export settings to 25 fps TFF in Premiere, using the same deinterlacing settings in Voukoder, the output file is 25 fps and flagged as interlaced, however the actual video stream is progressive.



    Log excerpt from exporting 50 fps progressive and bwdif deinterlacing:



    And exporting 25 TFF deinterlacing in Voukoder:



    I'm pretty sure I'm not doing anything wrong, is this a bug in deinterlacing? Or do I need to set up Voukoder in a very specific way to output 50p deinterlaced from 25i timeline?


    Also, some possible menu option order bugs in the Voukoder GUI:


    With bwdif, the field dropdowns do not match the values shown in parameters. "Send Frame" shows "send_field" and Send Field shows "send_frame". For deinterlacing options, Auto shows "tff", Top field first shows "bff" and "Bottom field first shows "auto". Yadif appears to be correct.


    Encode log files appear to be held open by Voukoder even after the encode is finished. I could not delete log files from Explorer after encodes had finished until Premiere was closed.

  • Deinterlacing


    You have to set premiere to export interlaced material (and the correct field order) so Voukoder knows it gets interlaced fields from premiere and can convert them to progressive frames. If you set it to "progressive" Voukoder already gets progressive frames.


    Framerate


    I am not exactly sure about the 25i to 50p conversion. But the more I think about this, the more I get the impression this is not about a single filter (bwdif) but more about a whole filter chain. Do you know with what FFmpeg command line you'd get the expected result?


    BWDIF


    Fixed that. Thanks for pointing it out. Will be available in the next release.


    LOG


    This is fixed already and will be available in the next version

  • Vouk

    Added the Label In Progress
  • Vouk

    Set the Label from Adobe Premiere / MediaEncoder to Independent

  • Hi Vouk


    Indeed. When I've been frameserving, Debugmode Frameserver provides no output video option, so you export a 1080i25 proxy and process with ffmpeg. (Confirmed with MediaInfo.)


    That proxy .avi is referenced with an incredibly simple .avs to work around an ffmpeg issue


    frameserver.avs:

    Code
    AviSource("F:\project\export\fsproxy.avi")


    Then ffmpeg produces the 50p output with bwdif deinterlacing:


    Code
    ffmpeg.exe -i "F:\project\frameserver.avs" -vf "bwdif" -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p -c:a aac -b:a 320k "F:\project\output\output-1080p50.mp4"


    Which works as expected.


    Incidentally, I was also doing some more complex processing to produce lower resolution preview clips which also worked fine, e.g.

    Code
    ffmpeg -i "F:\project\frameserver.avs" -vf "bwdif,scale=960:-1:flags=spline,unsharp=3:3:0.5:3:3:0.0" -c:v libx264 -tune film -crf 18 -preset slow -maxrate 3M -bufsize 1.5M -profile:v high -pix_fmt yuv420p -c:a aac -b:a 320k "F:\project\output\clip-960x540p50-crf18-3mbit.mp4"


    However the HQ clips I was simply trying to encode to MP @L4.2 or L5.0, CRF 18, with bwdif doing the 50p output. Is this a possible filter issue...?


    Or is this not even possible exporting directly from Premiere?


    If Premiere is expecting to directly render a 25i file, while Voukoder is attempting to generate a 1080p50 file (due to Yadif or bwdif filter rendering a frame for every input field), I can foresee a potential conflict. Likewise, if Premiere thinks it should be directly exporting a 1080p50 file, I wonder if it's going to improperly serve video frames to Voukoder and attempt to create the file incorrectly...


    I defer to your knowledge though, I've never written a plugin for Premiere :)


    This is a really useful feature for me so I'm happy to help however I can.


    I can send examples of the same content exported debugmode+ffmpeg 1080i25 to bwdif 1080p50, and Voukoder 1080i25 to bwdif 1080p50, if it would be useful / if you're interested.

  • I have the impression we'll need to set premiere to 25fps interlaced and the voukoder has to export with 50fps progressive (because a deinterlace filter is active). Can you send me some interlaced footage to test this?

  • Hi Vouk, sorry I didn't reply sooner -- my computer mainboard managed to completely fry my CPU, and I've only just managed to fit a new mainboard and CPU. (An expensive job...)


    I'll PM you a link to a shared folder with some clips in - two ProRes files clipped from the source files (no reencoding), and a sample file showing a successful bwdif deinterlace of another clip using ffmpeg on the commandline.

  • Alright, Chris. It took me around 7 hours today but it seems to be fixed now. And it is as easy as it can be. Just keep the default video settings (25i, tff), add the bwdif / yadif filter and start the export.


    Available in the next release.

  • Vouk

    Set the Label from In Progress to Fixed
  • Amazing, bravo... I wish I was as efficient... (took me several hours to get out of bed today)


    I'll give it a try as soon as the next release is out. I'm very interested to know how you solved it!

  • The tricky thing was that premiere feeds in 25 frames (50 interlaced fields) and the deinterlacing method "bob" creates 50 full frames out of each field. So it doubles the export frame rate. Normally voukoder creates all frames by itself and marks each frame with an unique and incremental PTS (Presentation time stamp). The "bwdif" filter added the additional frames by itself, so Voukoder didn't know about the correct next PTS value. Additionally the interleaving functionality had to be changed to keep the audio and video at the same length and in sync.


    https://github.com/Vouk/voukod…afd32663f2097a98a23c9bd6e