fat-tire / resolve

Container scripts to build and run DaVinci Resolve [Studio] for Linux using Docker or Podman
MIT License
193 stars 23 forks source link

Thank you so much! #46

Closed c0debreaker closed 10 months ago

c0debreaker commented 10 months ago

So happy I found this! It worked like a charm. Previously, I was using a deb file to install Davinci Resolve. I was able to use it for weeks. However, looks like I installed some packages that ruined the libraries which affected Davinci Resolve from starting. I tried replacing libpango libglib without luck. So I tried fat-tire. OMG, it was so smooth! Thanks a lto!

fat-tire commented 10 months ago

Hey thanks! Yeah it's nice to have everything packaged together in the official OS recommended by Blackmagic, and isolated so that you can roll back to older versions if needed.

If you haven't yet, try turning on the RESOLVE_BUILD_X264_ENCODER_PLUGIN=Y flag and see how the x264 codec works for you!

Thanks again for the kind words!

c0debreaker commented 10 months ago

Will do! Thanks a lot for the tip! :)

c0debreaker commented 10 months ago

I just rebuilt resolve by running export RESOLVE_BUILD_X264_ENCODER_PLUGIN=Y followed by ./build.sh. It completed successfully. I started Davinci and I looked around. I can't see any changes? I was assuming I'll be able to export it to an mp4 but I don't see it in the dropdown. Did I miss any step?

fat-tire commented 10 months ago

You should see the new option in the "Deliver" section (the rocket ship icon at the bottom).

After you choose the MP4 container format (or Quicktime, but you can't export with sound with it in linux), you should see a few Codec options listed including H.264 and H.265 (that is, if you have an NVidia card-- this is their NVEC hardware-based implementations.) I can't remember if H.264 appears on non-Studio versions of DaVinci Resolve or not.

Regardless, what's new here is that you'll hopefully see AVC (plugin) listed as well under Codec, along with with a Type that says x264 (plugin) and a bunch of settings that go with it.

This x264 plugin is what you just custom-built from the very latest upstream source code in combination with the patched /opt/resolve/Developer/CodecPlugin/Examples/x264_encoder_plugin/ sample code provided by BlackMagic Design.

If you don't have an NVidia card, this might be a nice way to add h.264 codec support to Resolve. Same if the H.264 plugin is for paid Studio only (again, I can't remember) and you're using the non-paid version. Some online think the x264 codecs are better codecs for video than NVidia's NVEC encoders, but you can do your own test and see what you prefer.

Regardless, you've hopefully got a new codec option now, so if it works and you like it, let me know as I think maybe it should be turned on by default (?)

c0debreaker commented 10 months ago

I just restarted Resolve and I went to the Deliver section. Then I clicked the Format where Quicktime was the default. I scrolled but I didn't see MP4. I saw MJ2, MKV, MXF Op Atom, MXF OP1a, PNG, Quicktime, etc. No MP4 from the dropdown. I there a different way of launching ./resolve.sh to enable it?

c0debreaker commented 10 months ago

This is what I see - https://www.youtube.com/watch?si=QTW1o3q81-80_X9l&v=cthNjjDC_yQ&feature=youtu.be

c0debreaker commented 10 months ago

What I'll do is update the if condition and force it. I'll let you know later.

I forced it but docker build didn't see any changes in the docker image which means that that docker image I built earlier does have the x264 encoder plugin compiled.

See very end of the command. I changed it to 1 instead of ${BUILD_X264_ENCODER_PLUGIN}

${CONTAINER_BUILD} -t "resolve:${TAG}" -t "resolve" --build-arg ARCH=`uname -m` --build-arg ZIPNAME="${ZIPNAME}" --build-arg BASE_IMAGE="${BASE_IMAGE}" --build-arg NVIDIA_VERSION="${NVIDIA_VERSION}" --build-arg USER_ID="${USER_ID}" --build-arg NO_PIPEWIRE="${NO_PIPEWIRE}" --build-arg BUILD_X264_ENCODER_PLUGIN="1"
c0debreaker commented 10 months ago

I docker system prune and deleted all the images so I have nothing right now. ./build.sh is running right now. I'll keep you posted.

c0debreaker commented 10 months ago

The build.sh is completed. I started resolve. Then I loaded a .mov video. I still cannot export to MP4. There is no option for it.

fat-tire commented 10 months ago

Very strange that it's not there-- a couple quick questions:

In the sample code used to build the plugin the AVC (plugin) plugin announces/registers itself as being compatible with .mov and .mp4 container formats. I'm not sure why it isn't appearing then under Quicktime/AVC (plugin) even if you don't have the mp4 support, but it would help to verify your hardware & whether or not it built successfully.

Thx for the testing!

c0debreaker commented 10 months ago

Yep, it's present. Here's the result of ls -lrtR

$ ls -lrtR x264_encoder_plugin.dvcp.bundle/
x264_encoder_plugin.dvcp.bundle/:
total 4
drwxr-xr-x 3 root root 4096 Jan  8 23:49 Contents

x264_encoder_plugin.dvcp.bundle/Contents:
total 4
drwxr-xr-x 2 root root 4096 Jan  8 23:49 Linux-x86-64

x264_encoder_plugin.dvcp.bundle/Contents/Linux-x86-64:
total 2488
-rwxr-xr-x 1 root root 2543792 Jan  8 23:49 x264_encoder_plugin.dvcp

In the free version of Davinci Resolve using a standard install like from a Debian or Fedora package, the mp4 is not supported. I was aware of it for years. However, when I read the RESOLVE_BUILD_X264_ENCODER_PLUGIN=Y, I had an impression that it was a hack/workaround to get MP4 format supported on Linux.

I have a GeForce GTX 1080 video card.

Thank you for responding. I really appreciate it a lot!

c0debreaker commented 10 months ago

I checked the pdf link you sent. For H.264, only Studio is supported. However for Av1, we can assume that Free version should support it since it doesn't mention Studio. It just mentions GPU accelerated. Now, is there a parameter we can pass to build.sh to enable AV1 plugin?

c0debreaker commented 10 months ago

I got the AV1 working. I had to create a video using libaom-av1 codec in ffmpeg. The extensions I used are mkv and mp4 and both worked. Resolve was able to decode it as well as encode it. The encoded version had a .avi extension.

The encoding though in ffmpeg eats my cpu a lot. Encoding of a 5 second small resolution clip using ffmpeg took almost 10 mins, LOL.

fat-tire commented 10 months ago

Cool, well.. glad you got av1 working even if it's slow. I hadn't realized they put that in there yet- thought it needed the new 40x80 Nvidia hardware. But anyway, so long as everything's working I'm happy. Definitely can use ffmpeg for anything you don't have :)