# VideoIO.jl doesn't seem to use GPU for video encoding on server with GPU

**URL:** <https://discourse.julialang.org/t/videoio-jl-doesnt-seem-to-use-gpu-for-video-encoding-on-server-with-gpu/119132>\
**Category:** General Usage\
**Created:** [September 6, 2024, 3:17pm UTC](https://discourse.julialang.org/t/videoio-jl-doesnt-seem-to-use-gpu-for-video-encoding-on-server-with-gpu/119132 "2024-09-06T15:17:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pxshen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pxshen/32/38776_2.png) [@pxshen](https://discourse.julialang.org/u/pxshen)\
**Post date:** [September 6, 2024, 3:17pm UTC](https://discourse.julialang.org/t/videoio-jl-doesnt-seem-to-use-gpu-for-video-encoding-on-server-with-gpu/119132/1 "2024-09-06T15:17:45Z")

</div>

I’m on Google Colab with L4 GPU. VideoIO.jl seems to run entirely on CPU despite L4 having hardware video decoders. Is there a setting somewhere?

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [September 6, 2024, 4:53pm UTC](https://discourse.julialang.org/t/videoio-jl-doesnt-seem-to-use-gpu-for-video-encoding-on-server-with-gpu/119132/2 "2024-09-06T16:53:36Z")

</div>

EDIT: Make sure you have new enough versions, and something like this needed? “FFMPEG.exe(`-h encoder=h264_nvenc`)”, i.e. it seems to have GPU support, by what I found here: [Update to FFMPEG\_jll 4.3.1 with optional nvidia hardware accelerated encoding by IanButterworth · Pull Request #32 · JuliaIO/FFMPEG.jl · GitHub](https://github.com/JuliaIO/FFMPEG.jl/pull/32#issuecomment-668193110)

It has encode and decode for at least AC1, and likely more codecs, so make sure you de/encode to correct (supported) codec:

> **[Supercharging AI Video and AI Inference Performance with NVIDIA L4 GPUs |...](https://developer.nvidia.com/blog/supercharging-ai-video-and-ai-inference-performance-with-nvidia-l4-gpus/)**
>
> NVIDIA T4 was introduced 4 years ago as a universal GPU for use in mainstream servers. T4 GPUs achieved widespread adoption and are now the highest-volume NVIDIA data center GPU. T4 GPUs were deployed…

> **[NVIDIA FFmpeg Transcoding Guide | NVIDIA Technical Blog](https://developer.nvidia.com/blog/nvidia-ffmpeg-transcoding-guide/)**
>
> All NVIDIA GPUs starting with the Kepler generation support fully-accelerated hardware video encoding, and all GPUs starting with Fermi generation support fully-accelerated hardware video decoding.

You mention “video encoding” in the title, but “video decoders” in the main text (so which are you interested in?). GPU hardware might only have the latter, and not the former? Or maybe at least the former not with VideoIO support?

I’m not sure if VideoIO supports both, either or neither, for GPUs that is, i.e. is that your question and then how?

L4 seems to mean Nvidia GPUs here (and they are supported if a package tries to support it actively, by depending on e.g. CUDA.jl directly or indirectly, and I did not see that done); and L4 in Colab w/TPUv2 support.

> **[NVIDIA L4 Tensor Core GPU](https://www.nvidia.com/en-us/data-center/l4/)**
>
> Optimize AI and graphics to accelerate workloads.

[https://www.reddit.com/r/GoogleColab/comments/1c1r8aa/details\_on\_new\_accelerators\_l4\_and\_tpuv2/](https://www.reddit.com/r/GoogleColab/comments/1c1r8aa/details_on_new_accelerators_l4_and_tpuv2/)

VideoIO is based on FFMPEG.jl and FFMPEG has GPU support, just unclear if exposed by VideoIO, and then how, or should you use FFMPEG directly if not? That would likely not need CUDA.jl.
