NatronGitHub / Natron

Open-source video compositing software. Node-graph based. Similar in functionalities to Adobe After Effects and Nuke by The Foundry.
http://NatronGitHub.github.io
GNU General Public License v2.0
4.63k stars 337 forks source link

DnxHR is not properly formatted #329

Closed cgvirus closed 3 years ago

cgvirus commented 5 years ago

Just to let all know, DnxHR is not properly formatted although DnxHD is alright. Problem: DnxHR can't write metadata through Natron and can't be recognized in Windows and some NLE.

The ffmpeg string for this should be, if in MLT: vcodec=dnxhd profile=dnxhr_lb

in ffmpeg format: -c:v dnxhd -profile:v dnxhr_lb

Where lb is offline quality. there are also sq , hq, hqx, 444

more info : ffmpeg -h encoder=dnxhd https://en.wikipedia.org/wiki/DNxHR_codec

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/72432963-dnxhr-is-not-properly-formatted?utm_campaign=plugin&utm_content=tracker%2F83915136&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F83915136&utm_medium=issues&utm_source=github).
devernay commented 5 years ago

Which profile are you trying to write? At what resolution?

What is wrong with the output file?

Can you please give the output of ffprobe on the resulting video, and on a DNxHR video that works on windows, so that we can figure out the difference?

Does the file play in VLC?

The relevant code is here (you can take a peek at comments too): https://github.com/NatronGitHub/openfx-io/blob/master/FFmpeg/WriteFFmpeg.cpp#L392 and here: https://github.com/NatronGitHub/openfx-io/blob/master/FFmpeg/WriteFFmpeg.cpp#L2980 I'm afraid I won't have time to look into this anytime soon, so if someone wants to take care of this, I'll accept any relevant PR on openfx-io.

devernay commented 5 years ago

I don't understand the last part: there are different profiles for DnxHR and DNxHD.

See source code: https://github.com/NatronGitHub/openfx-io/blob/master/FFmpeg/WriteFFmpeg.cpp#L5729

And doc: https://natron.readthedocs.io/en/rb-2.3/plugins/fr.inria.openfx.WriteFFmpeg.html

cgvirus commented 5 years ago

Hi, I have tested the clip with Kdenlive in Linux box with DnXHR. In Linux, Render from Natron can't show the video profile details whereas Kden does. For Linux seems to be working all fine just without showing the details/ metadata.

The problem was discovered in FB by a user and I have told him to follow this issue no. Let him discuss the problem. For me it was playing in VLC fine too. I have edited the last line...Seems to be already implemented.

Here's his complain:

I think Natron has a problem deal with DnxHR read and write. Not just for me, every machine in my studiois same. I realize now it is not read properly DnxHR. There is some black frames and freeze frames during playback. Furthermore read DnxHr and write Proress or something else, same problem is going on. Editing sends to us footages as DnxhR and wants to same format. So we can not work with Natron. But Prorress is OK. We have another project is going on with Proress. Everything looks ok

Here is the probe:

With Kdenlive:

production@production:~/Desktop$ ffprobe '/home/production/Desktop/afdaf.mov' 
ffprobe version 4.1.1-1 Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 8 (Debian 8.2.0-20)
  configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/production/Desktop/afdaf.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf58.20.100
  Duration: 00:00:08.53, start: 0.000000, bitrate: 181421 kb/s
    Stream #0:0(eng): Video: dnxhd (DNXHR LB) (AVdh / 0x68645641), yuv422p(tv, bt709/unknown/unknown), 3840x2160, 179896 kb/s, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 15360 tbn, 15360 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

With Natron:

production@production:~/Desktop$ ffprobe '/home/production/Desktop/sdad.mov' 
ffprobe version 4.1.1-1 Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 8 (Debian 8.2.0-20)
  configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/production/Desktop/sdad.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
  Duration: 00:00:02.34, start: 0.000000, bitrate: 179694 kb/s
    Stream #0:0(eng): Video: dnxhd (DNXHR LB) (AVdh / 0x68645641), yuv422p(tv, bt709/unknown/unknown), 3840x2160, 179716 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : DNxHR LB
devernay commented 5 years ago

I do not see anything wrong from the ffprobe. All I see is that the fps is different, for some reason.

The problem does not seem to be that the files don't play, but that they have black frames, am I right?

My main recommendation for this user is to not use video files as output for production work. Even Nuke does not output video files (at least last time I used Nuke). Render to frames and convert to video (while muxing audio) on the command-line. Rendering will also be much faster that way.

The explanation: when rendering to video, the frames have to be rendered in the right order, whereas when rendering to individual frames all frames can be rendered in parallel. Many bugs are triggered by rendering to video, so avoid that for production work. It may be used for very simple compositing graphs, after checking on a few examples that the quality is OK.

cgvirus commented 5 years ago

This is exactly I have suggested too...Why compositing needs to be in a intermediate format IDK. I have not seen any studio which uses intermediate as a render output especially from a compositor. QTRLE is one exception though. But that's about it. Anyway I don't think this is a valid issue as well.

Off topic: I want to build and bug out some minor issues with Natron in Linux. Where should I go for some interaction? Please Let me know. Thanks. @devernay

devernay commented 5 years ago

To build Natron on Linux:

Most of the stuff I used to build Natron is in https://github.com/NatronGitHub/Natron/tree/RB-2.3/tools

You can look at the scripts that do the travis builds (https://travis-ci.org/NatronGitHub/Natron).

Another option is to use the stuff that @Sunderland93 used to make the flatpak package (#258 and https://github.com/flathub/fr.natron.Natron). @Sunderland93 may be able to help too

cgvirus commented 5 years ago

I have successfully built and run Natron in Qt creator just now on Debain 10. The SDK was very helpful. Thanks! Let's see.

BarthezT commented 5 years ago

Hi I am Berat. I am a compositor from Turkey. We have a some problems with DnxHR footages in Natron(I think Especially in clips longer than 50 frames). Main issue is DnxHr footages in Natron does not play correctly. Some frames are freezing or some black frames are showing up. Every different session is showing errors on different frames. Sometimes I am getting an error: FFmpeg Reader detected decoding stall. Possible file corruption. But there is no problem in source. Because we are working without any problems in AE or in Nuke with the same footages. It is the same for our other stations even mac. We have another problem with DnxHR. Exporting Dnxhr has the same issues. Exported file has same still and black frames. when import into nuke or AE the exported file shown corrupted. Same in the Quicktime player. Only VLC is playing regularly but has the same still frames and black frames.

I am using Natron 2.3.14 Win10 Ryzen1950X 1070 GPU

devernay commented 5 years ago

Is the problem with DNxHR reading or writing? The FFmpeg reader has to be rewritten from scratch. It was written starting from the linux Nuke reader (code is available for this), but the Nuke reader code is made for a very old ffmpeg version and is probably obsolete (thus the decoding stalls etc). Any help on this would be useful. If possible, the new ffmpeg reader has to be backward compatible (same parameters, same behavior).

BarthezT commented 5 years ago

Both. I have problem reading and writing.

devernay commented 3 years ago
devernay commented 3 years ago

This seems to be fixed by https://github.com/NatronGitHub/openfx-io/pull/6 and https://github.com/NatronGitHub/openfx-io/pull/5 (see attached project dnxhr.ntp.zip, which renders all DNxHR profiles)

@cgvirus @BarthezT can you please test with the binaries from https://github.com/NatronGitHub/Natron/releases/tag/v2.3.16-beta2 ?

dnxhr.ntp.zip

cgvirus commented 3 years ago

Working Proper for me! Thanks!

devernay commented 3 years ago

fixed by https://github.com/NatronGitHub/openfx-io/pull/6 and https://github.com/NatronGitHub/openfx-io/pull/5 (see attached project dnxhr.ntp.zip, which renders all DNxHR profiles)