lisamelton / other_video_transcoding

Other tools to transcode videos.
MIT License
550 stars 25 forks source link

Docker Support #4

Closed jwmoss closed 4 years ago

jwmoss commented 4 years ago

Are there any plans to add docker support?

lisamelton commented 4 years ago

@jwmoss I have no plans to add Docker containers to the project because I see that as an installation and packaging issue outside the scope of what I'm doing here. Also, I have no expertise in that area.

However, one user has already created a Docker container:

https://github.com/rcarmo/docker-other-video-transcoding

I haven't tried installing it and have no plans to do so. And obviously I can't speak to the capabilities and quality of that container.

It's possible that @ttyS0, one of my collaborators, will create a Docker container soon. In fact, I've encouraged him and other folks on the team to do so because I'm sure other users (Ta da! like yourself :) would be interested.

Keep in mind that access to hardware encoders from within a Docker container is problematic. It's a solvable problem but it may not be solvable in a completely portable way.

But @ttyS0 can explain these issue much better than me so I'll leave that to him.

Thanks for opening this issue so we could start a discussion!

skj-dev commented 4 years ago

Hi @jwmoss,

The biggest issue with Docker in the context of this project is, as @donmelton mentioned, the hardware component. Since Docker requires a Linux system (I'm disregarding Windows containers, since they are still very experimental), using a Docker container on either a Windows or macOS system involves the use of a Linux VM where the Docker engine runs. Both Docker for Mac and Docker for Windows install such a VM, but it's not easily accessible or directly configurable, since it's only intended to run the Docker engine. That means for hardware acceleration on those platforms to work with a Docker container, the hardware GPU has to first be passed into the Linux VM installed by (and for) Docker, and then passed to a Docker container. Jumping through those hoops doesn't provide any obvious advantage since @donmelton's software is already able to run natively on all those platforms with minimal installation effort.

From my perspective a Docker container becomes useful in the context of automated scheduling of transcoding jobs with hardware assist. That presupposes nodes with the requisite hardware, and a scheduling system like Hashicorp Nomad, Kubernetes, or similar. The scenario I'm specifically focussing on is Kubernetes.

In short, if you're looking to run the hardware transcoder in a Docker container on a single system, such as a desktop or laptop, you're going to be best served by just running the software directly on the system. If, however, you're looking at making a hardware transcoder pipeline, then when I get something that's not too terrible to look at up and running, I will definitely add a comment into this issue so you can get notified.

As to it being done soon ... well, as a vastly smarter person than I once said, "the future is long". 😎

lisamelton commented 4 years ago

@ttyS0 That's an awesome response! Thanks!

jwmoss commented 4 years ago

Hi @ttyS0,

Thanks for the response! I currently run docker containers in unRAID and passthru QuickSync and can understand how that can be challenging in regards to this project. Thanks for the thorough reply. I await to see what you end up doing with this soon 😄

skj-dev commented 4 years ago

@jwmoss If you're wanting to use VAAPI hardware acceleration (i.e. Intel GPU), I have a functioning container for Don's other-transcoding over here: https://github.com/ttyS0/docker-transcode-vaapi

I still have to write out the documentation, but I'm pushing the image to GitHub, and it can be pulled from there. For basic usage, assuming you're in a directory foo, and have a source file in foo/bar/file.mkv, the command to transcode it with the Docker container is:

docker run --device /dev/dri:/dev/dri -v $(pwd):$(pwd) -w $(pwd) docker.pkg.github.com/ttys0/docker-transcode-vaapi/other-transcode-vaapi:0.2.0 bar/file.mkv

I have some other work to do to get it ready for a K8s environment, and I may end up putting a script as the ENTRYPOINT, but the basic functionality is there. If you run into troubles, feel free to give a yell! A container with Nvidia support will be coming .... ahem ..... soon. 😎

lisamelton commented 4 years ago

@ttyS0 This is awesome! Thank you so much, sir!

lisamelton commented 4 years ago

@jwmoss I'm closing this now because I finally remembered to check in the link to @ttyS0 's awesome Docker container into the "README" document. D'oh!

skj-dev commented 4 years ago

@jwmoss Just thought I'd mention that, in this case, soon meant .... about 3 months? 😎

There's an NVidia Docker container for other-transcode now: https://github.com/ttyS0/docker-transcode-nvidia

To use it on a Linux system (I've only tested on Ubuntu 18.04), you'll need the latest NVidia drivers (440.64), Docker-CE (not the Docker bundled with the distro) 19.03 or later, and nvidia-container-toolkit. Once all those things are in place, running the container with the --gpus all option will hook it onto the NVidia card.

For example, the following will encode src/file.mkv using HEVC:

docker run --gpus all -v $(pwd):$(pwd) -w $(pwd) ttys0/other-transcode-nvidia:v0.3.0 --hevc src/file.mkv

😸