Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Render Title Images --> "Invalid" #27

Closed
morphological opened this issue Jul 22, 2018 · 17 comments
Closed

Cannot Render Title Images --> "Invalid" #27

morphological opened this issue Jul 22, 2018 · 17 comments

Comments

@morphological
Copy link

Successfully compiled melt and it works fine, except when I try to render kdenlvie title clips, the rendered file just shows a black screen saying "Invalid".

The problem is the "kdenlivetitle" module, which is apparently not enabled by default, but I cannot seem to figure out how to get it working. Any ideas?

`Configuring framework:
Configuring modules:
Configuring modules/avformat:
Configuring modules/core:
Configuring modules/decklink:
Configuring modules/feeds:
Configuring modules/frei0r:
Configuring modules/gtk2:
- Libexif found, enabling auto rotate
Configuring modules/jackrack:
Configuring modules/kdenlive:
Configuring modules/lumas:
Configuring modules/ndi:
- NDI SDK not found: disabling
Configuring modules/oldfilm:
Configuring modules/opencv:
- OpenCV >= 3.1.0 NOT found, disabling OpenCV modules
Configuring modules/opengl:
Configuring modules/plus:
- libebur128 found: using external libebur128
Configuring modules/rtaudio:
Configuring modules/sdl:
 - using SDL version 1.2.15
Configuring modules/sdl2:
 - using SDL version 2.0.8
Configuring modules/sox:
Configuring modules/swfdec:
- swfdec not found: disabling
Configuring modules/vmfx:
Configuring modules/xml:
Configuring mlt++:
Configuring swig:
LGPLv2.1 license used; GPL components disabled
`
@ddennedy
Copy link
Member

You need to specify which script you are using and exactly how you are making something occur. Again, if you are using the kdenlive-build script, that is no longer supported for execution.

@morphological
Copy link
Author

morphological commented Jul 22, 2018

I am using the latest mlt-master git:
https://github.com/mltframework/mlt.git

I installed all the dependencies available on Ubuntu 18.04, and proceeded with ./configure and make && make install

I then tested the resulting melt binary with both the AppImage and stable ppa version of Kdenlive and in both instances I was unable to render title clips, as the output file would simply depict a black screen saying "Invalid".

What could be causing this?
During the configuration of the mlt modules, there was no report of a missing dependency or disabled module, relating to kdenlivetitle or qimage.

@ddennedy
Copy link
Member

ddennedy commented Jul 22, 2018

I then tested the resulting melt binary with both the AppImage and stable ppa version of Kdenlive

How? Did you specify the particular melt executable in kdenlive settings? The problem with that approach is the melt is dynamically linked to the MLT libs, and this does not guarantee that you are using the MLT that you built. If you run ldd /path/to/your/melt, then you can see which libmlt.so is being used.

I am not sure what the cause of this problem is. You should see a message like "[producer_xml] failed to load producer" in the melt output. As you noted, it is failing to load the kdenlivetitle, but I am not sure why. Maybe there is a broken dependency or incompatible/invalid kdenlivetitle file. Once you get the path of libmlt.so that melt is using above, you can also ldd <libdir>/mlt/libmltkdenlive.so to see if all the libraries resolve. Also, when you run melt, it should report modules that fail to load.

Why are you not using the MLT that comes with AppImage or that apt installs when using the ppa? Does render work with those MLT builds?

@morphological
Copy link
Author

morphological commented Jul 22, 2018

Thank you for your efforts and input!

You are right, after compiling and installing, everything is put in /usr/local:

make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/xml'
install -m 755 ../libmltxml.so "/usr/local/lib/mlt"
install -d "/usr/local/share/mlt/xml"
install -m 644 mlt-xml.dtd "/usr/local/share/mlt/xml"
install -m 644 *.yml "/usr/local/share/mlt/xml"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/xml'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/vmfx'
install -m 755 ../libmltvmfx.so "/usr/local/lib/mlt"
install -d "/usr/local/share/mlt/vmfx"
install -m 644 *.yml "/usr/local/share/mlt/vmfx"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/vmfx'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/sox'
install -m 755 ../libmltsox.so "/usr/local/lib/mlt"
install -d "/usr/local/share/mlt/sox"
install -m 644 filter_sox.yml "/usr/local/share/mlt/sox"
install -m 644 filter_sox_effect.yml "/usr/local/share/mlt/sox"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/sox'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/sdl2'
install -m 755 ../libmltsdl2.so "/usr/local/lib/mlt"
install -d "/usr/local/share/mlt/sdl2"
install -m 644 *.yml "/usr/local/share/mlt/sdl2"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/sdl2'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/sdl'
install -m 755 ../libmltsdl.so "/usr/local/lib/mlt"
install -d "/usr/local/share/mlt/sdl"
install -m 644 *.yml "/usr/local/share/mlt/sdl"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/sdl'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/rtaudio'
install -m 755 ../libmltrtaudio.so "/usr/local/lib/mlt"
install -d "/usr/local/share/mlt/rtaudio"
install -m 644 *.yml "/usr/local/share/mlt/rtaudio"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/rtaudio'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/plus'
install -m 755 ../libmltplus.so "/usr/local/lib/mlt"
install -d "/usr/local/share/mlt/plus"
install -m 644 .yml "/usr/local/share/mlt/plus"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/plus'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/opengl'
install -m 755 ../libmltopengl.so "/usr/local/lib/mlt"
install -d "/usr/local/share/mlt/opengl"
install -m 644 .yml "/usr/local/share/mlt/opengl"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/opengl'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/oldfilm'
install -m 755 ../libmltoldfilm.so "/usr/local/lib/mlt"
install -d /usr/local/share/mlt/oldfilm
install -m 644 .svg "/usr/local/share/mlt/oldfilm"
install -m 644 .yml "/usr/local/share/mlt/oldfilm"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/oldfilm'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/lumas'
install -d /usr/local/share/mlt/lumas/PAL
install -d /usr/local/share/mlt/lumas/NTSC
install -m 644 PAL/
/usr/local/share/mlt/lumas/PAL
install -m 644 NTSC/
/usr/local/share/mlt/lumas/NTSC
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/lumas'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/kdenlive'
install -m 755 ../libmltkdenlive.so "/usr/local/lib/mlt"
install -d "/usr/local/share/mlt/kdenlive"
install -m 644 .yml "/usr/local/share/mlt/kdenlive"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/kdenlive'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/jackrack'
install -m 755 ../libmltjackrack.so "/usr/local/lib/mlt"
install -d "/usr/local/share/mlt/jackrack"
install -m 644 consumer_jack.yml "/usr/local/share/mlt/jackrack"
[ -f dummy ] && install -m 644 dummy "/usr/local/share/mlt/jackrack" || true
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/jackrack'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/gtk2'
install -m 755 ../libmltgtk2.so "/usr/local/lib/mlt"
install -d "/usr/local/share/mlt/gtk2"
install -m 644 .yml "/usr/local/share/mlt/gtk2"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/gtk2'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/frei0r'
install -m 755 ../libmltfrei0r.so "/usr/local/lib/mlt"
install -d "/usr/local/share/mlt/frei0r"
install -m 644 blacklist.txt "/usr/local/share/mlt/frei0r"
install -m 644 not_thread_safe.txt "/usr/local/share/mlt/frei0r"
install -m 644 param_name_map.yaml "/usr/local/share/mlt/frei0r"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/frei0r'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/feeds'
install -d "/usr/local/share/mlt/feeds/PAL"
install -d "/usr/local/share/mlt/feeds/NTSC"
install -m 644 PAL/
.
"/usr/local/share/mlt/feeds/PAL"
install -m 644 NTSC/
.
"/usr/local/share/mlt/feeds/NTSC"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/feeds'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/decklink'
install -m 755 ../libmltdecklink.so "/usr/local/lib/mlt"
install -d "/usr/local/share/mlt/decklink"
install -m 644 *.yml "/usr/local/share/mlt/decklink"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/decklink'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/core'
install -m 755 ../libmltcore.so "/usr/local/lib/mlt"
install -d "/usr/local/share/mlt/core"
install -m 644 data_fx.properties "/usr/local/share/mlt/core"
install -m 644 loader.dict "/usr/local/share/mlt/core"
install -m 644 loader.ini "/usr/local/share/mlt/core"
install -m 644 .yml "/usr/local/share/mlt/core"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/core'
make[2]: Entering directory '/home/frank/Downloads/mlt-master/src/modules/avformat'
install -m 755 ../libmltavformat.so "/usr/local/lib/mlt"
install -d "/usr/local/share/mlt/avformat"
install -m 644 blacklist.txt "/usr/local/share/mlt/avformat"
install -m 644 producer_avformat.yml "/usr/local/share/mlt/avformat"
install -m 644 consumer_avformat.yml "/usr/local/share/mlt/avformat"
make[2]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules/avformat'
make[1]: Leaving directory '/home/frank/Downloads/mlt-master/src/modules'
make[1]: Entering directory '/home/frank/Downloads/mlt-master/src/swig'
make[1]: Nothing to be done for 'install'.
make[1]: Leaving directory '/home/frank/Downloads/mlt-master/src/swig'
make[1]: Entering directory '/home/frank/Downloads/mlt-master/profiles'
rm -rf "/usr/local/share/mlt/profiles"
install -d "/usr/local/share/mlt/profiles"
install -m 644 * "/usr/local/share/mlt/profiles"
rm -f "/usr/local/share/mlt/profiles/"
~
rm -f "/usr/local/share/mlt/profiles/Makefile"
make[1]: Leaving directory '/home/frank/Downloads/mlt-master/profiles'
cp -R presets "/usr/local/share/mlt"

Yet ldd /usr/local/bin/melt which is the melt I compiled, shows links to /usr/lib/ which is the melt that was installed with kdenlive from the stable ppa. So now I only need to have the executable refer to the correct libs, right?

    linux-vdso.so.1 (0x00007ffc88397000)

libmlt.so.6 => /usr/local/lib/libmlt.so.6 (0x00007fa2ad065000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa2ace46000)
libSDL2-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0 (0x00007fa2acb16000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa2ac725000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa2ac521000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa2ad4a0000)
libasound.so.2 => /usr/lib/x86_64-linux-gnu/libasound.so.2 (0x00007fa2ac21b000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa2abe7d000)
libpulse.so.0 => /usr/lib/x86_64-linux-gnu/libpulse.so.0 (0x00007fa2abc2d000)
libsndio.so.6.1 => /usr/lib/x86_64-linux-gnu/libsndio.so.6.1 (0x00007fa2aba1d000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007fa2ab6e4000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007fa2ab4d2000)
libXcursor.so.1 => /usr/lib/x86_64-linux-gnu/libXcursor.so.1 (0x00007fa2ab2c8000)
libXinerama.so.1 => /usr/lib/x86_64-linux-gnu/libXinerama.so.1 (0x00007fa2ab0c5000)
libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007fa2aaeb5000)
libXrandr.so.2 => /usr/lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007fa2aacaa000)
libXss.so.1 => /usr/lib/x86_64-linux-gnu/libXss.so.1 (0x00007fa2aaaa6000)
libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007fa2aa8a0000)
libwayland-egl.so.1 => /usr/lib/x86_64-linux-gnu/libwayland-egl.so.1 (0x00007fa2aa69e000)
libwayland-client.so.0 => /usr/lib/x86_64-linux-gnu/libwayland-client.so.0 (0x00007fa2aa48f000)
libwayland-cursor.so.0 => /usr/lib/x86_64-linux-gnu/libwayland-cursor.so.0 (0x00007fa2aa287000)
libxkbcommon.so.0 => /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007fa2aa048000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fa2a9e40000)
libpulsecommon-11.1.so => /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-11.1.so (0x00007fa2a9bc2000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007fa2a9975000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007fa2a9760000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fa2a9538000)
libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007fa2a932e000)
libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007fa2a9128000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fa2a8f20000)
libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007fa2a8c9c000)
libwrap.so.0 => /lib/x86_64-linux-gnu/libwrap.so.0 (0x00007fa2a8a92000)
libsndfile.so.1 => /usr/lib/x86_64-linux-gnu/libsndfile.so.1 (0x00007fa2a8819000)
libasyncns.so.0 => /usr/lib/x86_64-linux-gnu/libasyncns.so.0 (0x00007fa2a8613000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007fa2a840f000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fa2a8209000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fa2a7fe3000)
liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007fa2a7dc7000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007fa2a7aac000)
libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007fa2a7892000)
libFLAC.so.8 => /usr/lib/x86_64-linux-gnu/libFLAC.so.8 (0x00007fa2a761b000)
libogg.so.0 => /usr/lib/x86_64-linux-gnu/libogg.so.0 (0x00007fa2a7412000)
libvorbis.so.0 => /usr/lib/x86_64-linux-gnu/libvorbis.so.0 (0x00007fa2a71e7000)
libvorbisenc.so.2 => /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2 (0x00007fa2a6f3e000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fa2a6d23000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fa2a6b0e000)

@ddennedy
Copy link
Member

OK, one way to do that is in a terminal:

export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
kdenlive (or /path/to/kdenlive or melt depending on what you are doing)

That environment variable export is effective only in that terminal window & session.

@morphological
Copy link
Author

There still seem to be some conflicts between libs.
I don't want to waste my time with you, so I will do a fresh install and only install the compiled mlt. Then I'll report back so that I can present clean results to you.

Again, thank you very much for your help and patience, most of all.

@morphological
Copy link
Author

morphological commented Jul 23, 2018

OK, I have done some extensive testing now.
After a fresh install of Kubuntu 18.04 and compiling/installing melt, title clips still appear as "Invalid" after rendering. However, render speeds are absolutely amazing.

To confirm that this is exclusively an issue with the melt that I built, I downloaded Shotcut (portable) and used the melt executable in the Kdenlive environment, but also generated a render script which I ran from the terminal, to be sure.
I am certain that it points to the correct libs, as this melt is launched by a script which first sets all the correct pointers:

#!/bin/sh
# Set up environment
# Run this instead of trying to run bin/melt. It runs melt with the correct environment.
CURRENT_DIR=$(readlink -f "$0")
INSTALL_DIR=$(dirname "$CURRENT_DIR")
export LD_LIBRARY_PATH="$INSTALL_DIR/lib":$LD_LIBRARY_PATH
export MLT_REPOSITORY="$INSTALL_DIR/lib/mlt"
export MLT_DATA="$INSTALL_DIR/share/mlt"
export MLT_PROFILES_PATH="$INSTALL_DIR/share/mlt/profiles"
export FREI0R_PATH="$INSTALL_DIR/lib/frei0r-1"
export MLT_MOVIT_PATH="$INSTALL_DIR/share/movit"
export QT_PLUGIN_PATH="$INSTALL_DIR/lib/qt5"
export QML2_IMPORT_PATH="$INSTALL_DIR/lib/qml"
"$INSTALL_DIR/bin/melt" "$@"

This version of melt is able to render title clips, but unlike the melt I built, it only uses 1 CPU core (despite specifying 4 threads in the render dialog/kdenlive settings/ and even the render script) subsequently taking much longer to render. (With the kdenlive-multi-render script available on github, I was able to get it to use two cores, though)

Ultimately, I need your assistance in properly compiling melt with all the required modules.
In the OP I posted the output of ./configure before compiling mlt.
NDI SDK, SFWDEC & OpenCV are disabled, as I could not find the dependencies anywhere.
Those modules are unrelated to kdenlive title clips, correct?

I compared the mlt modules in the Shotcut folder and my own, and noticed that the compiled melt was missing the following:

libmltlinsys.so
libmltmotion_est.so
libmltnormalize.so
libmltplusgpl.so
libmltqt.so
libmltresample.so
libmltvideostab.so
libmltwebvfx.so
libmltxine.so

Could any of those missing libs be causing the problem, and how would I add them while compiling melt, as no required dev packages are mentioned as a dependency?
libmltqt.so might be interesting, as I have read that qimage which relates to title images was renamed to qt.

Is there maybe something I need to enable while using ./configure --enable
such as for example ./configure --enable-qimage ?
I couldn't find anything regarding the various ./configure --enable options in the mlt documentation, but that could be interesting in this case, don't you think?

After doing some deep google searching, I found that other people's ./configure outputs list much more modules than mine.

I tried both the mlt zip from mltframework and the mlt-master git:
https://github.com/mltframework/mlt/releases --> version 6.10
https://github.com/mltframework/mlt.git --> version 6.11

What am I missing?

@bmatherly
Copy link
Member

libmltqt.so might be interesting, as I have read that qimage which relates to title images was renamed to qt.

You will need libmltqt.so because that is where kdenlivetitle lives:
https://github.com/mltframework/mlt/tree/master/src/modules/qt

Make sure your configure scripts includes "--enable-gpl" or qt will be excluded from the build. I can see from your OP that you did not have GPL enabled:

LGPLv2.1 license used; GPL components disabled

In your configure output, you should see:
Configuring modules/qt:

@morphological
Copy link
Author

Thanks for the tip!

I recompiled using ./configure --enable-gpl --enable-gpl3 and two things happened.

Title Clips work properly now, but only 1 CPU core is being used for rendering, quadrupling render times.
I specified 4 Threads in the Kdenlive Environment / 4 Threads in the Render Dialog and even checked if the generated render script says 4 threads, which it does.

With the previous melt all 4 cores were running at 100%, so something about the qt modules must still not be right.

Is there anything else I should --enable with regards to qt or any other related modules that pertain to the issue at hand?

Thanks again for the effort, guys!

@bmatherly
Copy link
Member

Is there anything else I should --enable with regards to qt or any other related modules that pertain to the issue at hand?

I doubt it. But I don't know anything about the kdenlivetitler. That is maintained by the KDENLIVE developers. It might be better to ask them.

@morphological
Copy link
Author

So --enable-gpl and --enable-gpl3 basically includes a whole bunch of qt modules, right?

If I get 100% CPU usage on all 4 cores without those two ./configure flags and only 1 CPU core with them, then something must be broken with qt or any other modules these two flags enable, wouldn't you agree?

@ddennedy
Copy link
Member

So --enable-gpl and --enable-gpl3 basically includes a whole bunch of qt modules, right?

No, it enables a few MLT modules, one of which is qt, which houses the kdenlivetitle service.

$ find . -name gpl
./src/modules/kino/gpl
./src/modules/linsys/gpl
./src/modules/motion_est/gpl
./src/modules/normalize/gpl
./src/modules/plusgpl/gpl
./src/modules/qt/gpl
./src/modules/resample/gpl
./src/modules/vid.stab/gpl
./src/modules/videostab/gpl
./src/modules/xine/gpl

If I get 100% CPU usage on all 4 cores without those two ./configure flags and only 1 CPU core with them, then something must be broken with qt or any other modules these two flags enable, wouldn't you agree?

No, parallel processing is a complicated subject. The services in the qt module cannot directly affect the parallelism of other modules such as avformat and the frame-threaded rendering in mlt_consumer.c. Some services are simply heavy or contain locks to prevent parallelism around code that is not thread-safe. These can create bottlenecks. As you noticed, if a service fails to load, then it repeatedly displays INVALID, which is going to process much faster than the real thing. There are not many build-time options that control parallelism, mainly just runtime. You said you checked it, but you did not specify. Mainly dependencies such as ffmpeg, vid.stab, qt, etc. have some compile-time options that affect performance such as enabling assemblers, libgomp, etc. Basically, there are many variables, and it depends - including your project. You can't honestly compare apples to lemons (incomplete build).

@morphological
Copy link
Author

morphological commented Jul 24, 2018

For this test I used mlt 6.11, successfully compiled by Dan Dennedy's build-melt.sh

The test file that I am using is the 1080p version of Sintel.
https://durian.blender.org/download/

CPU: i5 6600K, GPU:GTX 750 TI nvidia-390 driver , Platform: Kubuntu 18.04

In order to check melt and isolate the problem I simply rendered the first minute of the Sintel short film with the following command:
(This is not the /bin/melt, but the script which launches it with the correct libs)

/home/frank/melt/20180724/melt -profile atsc_1080p_60 sintel.mkv out=3600 -consumer avformat:result-60.mp4 f=mp4 vcodec=h264_nvenc preset=slow
[CPU Utilization: 67% - 70% - 68% - 74%] [Video Engine Utilization (NVENC): 80%] [Render Time: 20s]

It obviously works perfectly.

Now when I select this melt in the kdenlive environment, and also ffmpeg, ffplay, ffprobe and the profiles path from Dan's melt folder, yields the following results when rendering the first minute of Sintel.
[CPU Utilization: 100% - 7% - 10% - 18%] [Video Engine Utilization (NVENC): 8%] [Render Time: 2m54s]
Something in kdenlive breaks parallel processing, only allowing 1 single core to be fully utilized.

And I have tested every single version of kdenlive available on this earth.
Every app image, including the refractoring version and every single ppa version, including stable, dev and master.

Also generating and launching the render script from the terminal yields the same result.

RENDERER="/home/frank/kdenlive/bin/kdenlive_render"
MELT="/home/frank/melt/20180724/melt"

SOURCE_0="file:///home/frank/Documents/scripts/script001.sh.mlt"
TARGET_0="file:///home/frank/Documents/untitled.mkv"
PARAMETERS_0="-pid:2664 in=0 out=3052 $MELT atsc_1080p_60 avformat - $SOURCE_0 $TARGET_0 vcodec=nvenc_h264 threads=4 real_time=-1"
$RENDERER $PARAMETERS_0

I have also tested different kdenlive_render executables/libs with the same result.

I should note, that using the kdenlive_multirender script in conjunction with the generated render script by kdenlive, while specifying 4 threads, the CPU uses 2 cores at 100%.
https://github.com/unfa/kdenlive-multirender

Now as I have described before, when I compile melt without enabling gpl, the 1 minute of Sintel renders perfectly again, with full utilization on both the CPU and GPU, but from within Kdenlive this time.

I conclude that this problem is somehow caused by Kdenlive and related to qt, but I do not possess the knowhow to further analyze it.

Edit: With the latest 18.08 Beta18 and the most recent QT version, 2 cores instead of 1 are now being utilized at 100% with the NVENC profile.
I used the following command to implement the new qt libs.
export LD_LIBRARY_PATH="/home/frank/Qt5.11.1/5.11.1/gcc_64/lib/:$LD_LIBRARY_PATH"
QT5.11: http://download.qt.io/official_releases/qt/5.11

So this is 100% a QT issue, but I need further insight from a professional like yourself.

@ddennedy
Copy link
Member

ddennedy commented Jul 25, 2018

kdenlive_multirender talks about threads, but it is really processes. That piece unncessarily complicates the analysis and discussion. So, leave that out.

I see from your melt command line and the kdenlive render script that you are not using real_time < -1. If you use real_time=-<N> (goes after -consumer avformat), then MLT will use N rendering threads. That is the first thing to do to get more CPU usage. Try with -2 or -3. Anything less than -3 might not be as advantageous. Of course, as I explained above, due to concurrency limitations in parts of the code, that is not guaranteed to give N*100% results.

Next, Kdenlive uses Qt-based MLT transition qtblend to composite video tracks. If /home/frank/Documents/scripts/script001.sh.mlt has multiple tracks, then it might be in play and thus Qt's image processing. Perhaps your /home/frank/Qt5.11.1 has more optimizations enable by default than the one with your distribution. I know for sure that Qt can be configured at compile-time to disable various SIMD instruction sets to make a theoretically safer binary to execute (it is supposed to use run-time CPU detection to avoid illegal instructions, but maybe some orgs do not trust that enough). I do not know if Qt has support for stuff like OpenML and OpenCL that can be configured in a build to further optimize, but it's possible.

@morphological
Copy link
Author

Alright, I believe that I've figured it out, and shall report back after further testing.
It appears that the root cause of this issue has been Track Compositing, all along.

Here are my findings:

Rendering 1st minute of Sintel 1080p/60FPS , 4 Threads, NVENC enabled, Kdenlive 18.04 AppImage

.)Track Composition - "None"
[CPU Utilization: 70% - 67% - 64% - 80%] [GPU Utilization: 70%] [Render Time: 15s]
I noticed however, that transitions such as for example Slide or Composite are rendered improperly, with certain interference patterns.

After consulting the documentation, I realized that this should be fixed by disabling any surrounding empty tracks, but so far I have not been able to achieve that.

.)Track Composition - "Preview"
[CPU Utilization: 67% - 65% - 69% - 75%] [GPU Utilization: 65%] [Render Time: 20s]

I conclude that the best of both worlds comes into play with this option enabled.
Both the GPU and CPU are almost fully utilized, while it appears that transitions are rendered correctly.

.)Track Composition - "High Quality"
[CPU Utilization: 10% - 14% - 20% - 100%] [GPU Utilization: 6%] [Render Time: 2m58s]

I will do more thorough testing and read any documentation available, as I absolutely want to understand what exactly these options do.

I think it's a bit crazy to have "High Quality" enabled by default, which so heavily impacts performance, while in my opinion not making enough of an effort to alert the user to the extreme effects it may have on render times.

I literally spent 72 hours straight, compiling every single version of melt and kdenlive, documenting and testing every possible compilation parameter variation, performance reviews with every available version of Ubuntu, corresponding kernels and nvidia drivers, and every remotely related kdenlive option or workarounds.

Kdenlive Website:

High Quality: this uses the new Composite and Transform transition (internally known as qtblend). As this option name suggests, it is giving the best compositing quality, at a slight cost of performance. On a fast machine you might be well able to composite several layers of images (with transparency) onto a video clip and play back the timeline at 25fps.

@vpinon
Copy link
Contributor

vpinon commented Jul 25, 2018 via email

@morphological
Copy link
Author

Hey Vincent,

I already submitted my findings to the mailing list before I posted them here.
Check your mail!

I am getting really deep into this now.
By editing the .mlt file that is created with the kdenlive render script to provide instructions, specifically the mlt composite producer and nvenc entries, I am now able to achieve 100% on all 4 cores, but more impressively, 98% of video engine utilization.

Render Times have been reduced to 9-10s.

I should note that I have since then disabled the vid.stab module in mlt 6.11 and switched to nvidia-396, not sure if that is related.

I will post my final test results tomorrow and subsequently close this issue.

Thank you Dan, Vincent and Bmatherly!
I feel very lucky that we have such an active and helpful community with professionals such as yourselves who still take the time to offer their knowledge and support.

Without you this issue would have melted my face by now. (get it?)

@ddennedy ddennedy closed this as completed Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants