valadaptive / ntsc-rs

Free, open-source analog TV + VHS effect. Standalone application + plugin (After Effects, Premiere, and OpenFX).
Other
237 stars 4 forks source link

Internal data stream error when trying to render interlaced video as interlaced stream (v0.7.2) #118

Open Prankejten opened 3 weeks ago

Prankejten commented 3 weeks ago

If I try to render an interlaced (encoded as interlaced) video in NTSC-RS with the Use field setting on Interleaved, and set Interlaced output to true in the render settings, NTSC-RS gives the following error: Error creating pipeline: Internal data stream error.

I have tried both NTSC and PAL resolution interlaced videos, but neither of them renders at all.

Probably what causes this is that interlaced videos all get detected as "telecined" by NTSC-RS as far as I have seen and that might mess some stuff up and cause this error. Trying to render a progressive video (both encoded as progressive and detected by NTSC-RS as progressive with the Interlaced output setting will not give any errors.

Pretty funny because I would guess the interleaved mode is there for actual interlaced content. annoying issue with ntsc-rs

valadaptive commented 3 weeks ago

I've tested this with interlaced videos in the past and IIRC it's worked. There might've been some code changes so I'll test it again, but it would be helpful if you shared the video that you're having trouble with. There is a difference between telecined and interlaced videos, and I haven't tested the former.

Prankejten commented 3 weeks ago

There is a difference between telecined and interlaced videos, and I haven't tested the former.

The videos are encoded as an MPEG-2 interlaced stream and they are true interlaced, by telecined I meant NTSC-RS assumes they are telecined. The Use field setting is greyed out when a video that NTSC-RS guessed is telecined is selected and cannot be changed until you open another video, so maybe it was disabled for a reason, but idk.

but it would be helpful if you shared the video that you're having trouble with.

It's not just a specific video, it seems to be all videos encoded as an interlaced stream, at least with the MPEG-2 codec anyway. Neither NTSC or PAL spec video was rendered without giving an error though. I have to go now, but I'll do some additional testing to see if maybe only MPEG-2 interlaced streams fail to render.

valadaptive commented 3 weeks ago

I've confirmed that ntsc-rs doesn't work with telecined video; this will be fixed in the next release.

Here's an MPEG-2 interlaced video that ntsc-rs correctly recognizes as interlaced and not telecined. Can you share any example of these "MPEG-2 interlaced streams" that are showing up as telecined in ntsc-rs but interlaced when their metadata is inspected with e.g. ffmpeg?

Prankejten commented 3 weeks ago

Here's a short clip I recorded with my camera (Sony DCR-SX34E) a while ago, as an example for something that fails to render in NTSC-RS.

M2U00259.zip (sorry for the zip, github doesn't let me upload MPG files directly for some reason)

Prankejten commented 2 weeks ago

Hey, I downloaded the new version of NTSC-RS because I saw that my bug was fixed in it, and... it still throws an error kép Literally have no idea what's going on

Additionally here's the preset I'm trying to use, incase it throws an error over some effect being enabled, or I don't know Slightly crappy VHS (Interlaced).json

valadaptive commented 2 weeks ago

I'm not sure either; I'll have to investigate more. I can reproduce the issue with the video you sent, but if I re-encode the video using ffmpeg, it gets properly recognized as interlaced and renders with no issue. It may be a GStreamer bug.

alexlnkp commented 3 days ago

Can confirm, happens for me too (tried re-encoding as Quicktime and x264 ffprobe for both:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vid.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf61.1.100
  Duration: 00:07:48.01, start: 0.000000, bitrate: 739 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 480x270 [SAR 1:1 DAR 16:9], 604 kb/s, 24 fps, 24 tbr, 12288 tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
        encoder         : Lavc61.3.100 libx264
        timecode        : 01:00:00:00
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 129 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](eng): Data: none (tmcd / 0x64636D74)
      Metadata:
        handler_name    : VideoHandler
        timecode        : 01:00:00:00

and

  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vid.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf61.1.100
  Duration: 00:07:48.00, start: 0.000000, bitrate: 759 kb/s
  Stream #0:0[0x1]: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 480x270 [SAR 1:1 DAR 16:9], 624 kb/s, 24 fps, 24 tbr, 12288 tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : FFMP
        encoder         : Lavc61.3.100 libx264
        timecode        : 01:00:00:00
  Stream #0:1[0x2]: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 130 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](eng): Data: none (tmcd / 0x64636D74)
      Metadata:
        handler_name    : VideoHandler
        timecode        : 01:00:00:00

the re-encoded versions were made from a .MOV video rendered by davinci resolve OS specs:

OS: Arch Linux x86_64
Kernel: Linux 6.9.6-arch1-1
Packages: 1576 (pacman)
Display (GM27-FFS): 1920x1080 @ 165Hz
WM: Hyprland (Wayland)
CPU: 12th Gen Intel(R) Core(TM) i5-12400F (12) @ 4.40 GHz
GPU: NVIDIA GeForce RTX 3060 Lite Hash Rate [Discrete]
Memory: 6.41 GiB / 31.20 GiB (21%)

UPDATE: Okay, i tried clicking the "Render" button out of frustration; it worked... There also seems to be an issue with videos being read? Sometimes i can load a video, sometimes i can't. Seems completely random too...