How to use GPU acceleration in FFmpeg with AMD Radeon?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







2















I have a Radeon Vega 64, and installed AMDGPU from the official website, but I have no idea where to go from here.



I want to use hardware acceleration for converting video with FFmpeg. What is the corresponding FFmpeg command and how should I like the device/driver to FFmpeg?










share|improve this question


















  • 1





    Maybe this will help you: trac.ffmpeg.org/wiki/HWAccelIntro

    – Gannet
    Jan 7 at 23:42


















2















I have a Radeon Vega 64, and installed AMDGPU from the official website, but I have no idea where to go from here.



I want to use hardware acceleration for converting video with FFmpeg. What is the corresponding FFmpeg command and how should I like the device/driver to FFmpeg?










share|improve this question


















  • 1





    Maybe this will help you: trac.ffmpeg.org/wiki/HWAccelIntro

    – Gannet
    Jan 7 at 23:42














2












2








2








I have a Radeon Vega 64, and installed AMDGPU from the official website, but I have no idea where to go from here.



I want to use hardware acceleration for converting video with FFmpeg. What is the corresponding FFmpeg command and how should I like the device/driver to FFmpeg?










share|improve this question














I have a Radeon Vega 64, and installed AMDGPU from the official website, but I have no idea where to go from here.



I want to use hardware acceleration for converting video with FFmpeg. What is the corresponding FFmpeg command and how should I like the device/driver to FFmpeg?







18.04 ffmpeg gpu amdgpu






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 7 at 18:14









GooglebotGooglebot

30921637




30921637








  • 1





    Maybe this will help you: trac.ffmpeg.org/wiki/HWAccelIntro

    – Gannet
    Jan 7 at 23:42














  • 1





    Maybe this will help you: trac.ffmpeg.org/wiki/HWAccelIntro

    – Gannet
    Jan 7 at 23:42








1




1





Maybe this will help you: trac.ffmpeg.org/wiki/HWAccelIntro

– Gannet
Jan 7 at 23:42





Maybe this will help you: trac.ffmpeg.org/wiki/HWAccelIntro

– Gannet
Jan 7 at 23:42










1 Answer
1






active

oldest

votes


















2














I'll provide instructions for both Windows and Linux, as you've not indicated what platform you're on. Use these instructions that are applicable to your case.



If you're on Windows, you can access the related encoders via AMF, aptly named h264_amf and hevc_amf, whose usage can be viewed via:



ffmpeg -h encoder=h264_amf

ffmpeg -h encoder=hevc_amf


You'd need to build an FFmpeg binary for Windows, either natively, or as recommended, cross-compiling. This project is a great start on that subject.



If you use the cross-compile option, pass the arguments below for a build with the features you'll need:



./cross_compile_ffmpeg.sh --gcc-cpu-count=12  --build-libmxf=n --disable-nonfree=n --prefer-stable=y --compiler-flavors=multi


Note that the resulting build above is non-redistributable, and is only for personal use.



On Linux, using the opensource mesa amdgpu driver (not the proprietary package installed from AMD), you can access VAAPI-based encoders, aptly named h264_vaapi and hevc_vaapi, whose usage can be viewed via:



ffmpeg -h encoder=h264_vaapi

ffmpeg -h encoder=hevc_vaapi


To the best of my knowledge (correct me if I'm wrong), VP8 and VP9 encoding isn't exposed on AMD's side via VAAPI. You can confirm this by running:



vainfo | grep Slice


On your system and confirming what encoders are supported.
It's most likely that FFmpeg with VAAPI enabled is the default on the likes of Ubuntu.
However, you can also build a copy from source, if so needed. See the compilation guide on the FFmpeg Wiki, and adapt as needed. You may also find helpers, such as this, useful.



There's a possibility that the AMD AMF-based encoders will eventually land on Linux, using a Vulkan-based interop. Take this as a work in progress.






share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1107782%2fhow-to-use-gpu-acceleration-in-ffmpeg-with-amd-radeon%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    I'll provide instructions for both Windows and Linux, as you've not indicated what platform you're on. Use these instructions that are applicable to your case.



    If you're on Windows, you can access the related encoders via AMF, aptly named h264_amf and hevc_amf, whose usage can be viewed via:



    ffmpeg -h encoder=h264_amf

    ffmpeg -h encoder=hevc_amf


    You'd need to build an FFmpeg binary for Windows, either natively, or as recommended, cross-compiling. This project is a great start on that subject.



    If you use the cross-compile option, pass the arguments below for a build with the features you'll need:



    ./cross_compile_ffmpeg.sh --gcc-cpu-count=12  --build-libmxf=n --disable-nonfree=n --prefer-stable=y --compiler-flavors=multi


    Note that the resulting build above is non-redistributable, and is only for personal use.



    On Linux, using the opensource mesa amdgpu driver (not the proprietary package installed from AMD), you can access VAAPI-based encoders, aptly named h264_vaapi and hevc_vaapi, whose usage can be viewed via:



    ffmpeg -h encoder=h264_vaapi

    ffmpeg -h encoder=hevc_vaapi


    To the best of my knowledge (correct me if I'm wrong), VP8 and VP9 encoding isn't exposed on AMD's side via VAAPI. You can confirm this by running:



    vainfo | grep Slice


    On your system and confirming what encoders are supported.
    It's most likely that FFmpeg with VAAPI enabled is the default on the likes of Ubuntu.
    However, you can also build a copy from source, if so needed. See the compilation guide on the FFmpeg Wiki, and adapt as needed. You may also find helpers, such as this, useful.



    There's a possibility that the AMD AMF-based encoders will eventually land on Linux, using a Vulkan-based interop. Take this as a work in progress.






    share|improve this answer




























      2














      I'll provide instructions for both Windows and Linux, as you've not indicated what platform you're on. Use these instructions that are applicable to your case.



      If you're on Windows, you can access the related encoders via AMF, aptly named h264_amf and hevc_amf, whose usage can be viewed via:



      ffmpeg -h encoder=h264_amf

      ffmpeg -h encoder=hevc_amf


      You'd need to build an FFmpeg binary for Windows, either natively, or as recommended, cross-compiling. This project is a great start on that subject.



      If you use the cross-compile option, pass the arguments below for a build with the features you'll need:



      ./cross_compile_ffmpeg.sh --gcc-cpu-count=12  --build-libmxf=n --disable-nonfree=n --prefer-stable=y --compiler-flavors=multi


      Note that the resulting build above is non-redistributable, and is only for personal use.



      On Linux, using the opensource mesa amdgpu driver (not the proprietary package installed from AMD), you can access VAAPI-based encoders, aptly named h264_vaapi and hevc_vaapi, whose usage can be viewed via:



      ffmpeg -h encoder=h264_vaapi

      ffmpeg -h encoder=hevc_vaapi


      To the best of my knowledge (correct me if I'm wrong), VP8 and VP9 encoding isn't exposed on AMD's side via VAAPI. You can confirm this by running:



      vainfo | grep Slice


      On your system and confirming what encoders are supported.
      It's most likely that FFmpeg with VAAPI enabled is the default on the likes of Ubuntu.
      However, you can also build a copy from source, if so needed. See the compilation guide on the FFmpeg Wiki, and adapt as needed. You may also find helpers, such as this, useful.



      There's a possibility that the AMD AMF-based encoders will eventually land on Linux, using a Vulkan-based interop. Take this as a work in progress.






      share|improve this answer


























        2












        2








        2







        I'll provide instructions for both Windows and Linux, as you've not indicated what platform you're on. Use these instructions that are applicable to your case.



        If you're on Windows, you can access the related encoders via AMF, aptly named h264_amf and hevc_amf, whose usage can be viewed via:



        ffmpeg -h encoder=h264_amf

        ffmpeg -h encoder=hevc_amf


        You'd need to build an FFmpeg binary for Windows, either natively, or as recommended, cross-compiling. This project is a great start on that subject.



        If you use the cross-compile option, pass the arguments below for a build with the features you'll need:



        ./cross_compile_ffmpeg.sh --gcc-cpu-count=12  --build-libmxf=n --disable-nonfree=n --prefer-stable=y --compiler-flavors=multi


        Note that the resulting build above is non-redistributable, and is only for personal use.



        On Linux, using the opensource mesa amdgpu driver (not the proprietary package installed from AMD), you can access VAAPI-based encoders, aptly named h264_vaapi and hevc_vaapi, whose usage can be viewed via:



        ffmpeg -h encoder=h264_vaapi

        ffmpeg -h encoder=hevc_vaapi


        To the best of my knowledge (correct me if I'm wrong), VP8 and VP9 encoding isn't exposed on AMD's side via VAAPI. You can confirm this by running:



        vainfo | grep Slice


        On your system and confirming what encoders are supported.
        It's most likely that FFmpeg with VAAPI enabled is the default on the likes of Ubuntu.
        However, you can also build a copy from source, if so needed. See the compilation guide on the FFmpeg Wiki, and adapt as needed. You may also find helpers, such as this, useful.



        There's a possibility that the AMD AMF-based encoders will eventually land on Linux, using a Vulkan-based interop. Take this as a work in progress.






        share|improve this answer













        I'll provide instructions for both Windows and Linux, as you've not indicated what platform you're on. Use these instructions that are applicable to your case.



        If you're on Windows, you can access the related encoders via AMF, aptly named h264_amf and hevc_amf, whose usage can be viewed via:



        ffmpeg -h encoder=h264_amf

        ffmpeg -h encoder=hevc_amf


        You'd need to build an FFmpeg binary for Windows, either natively, or as recommended, cross-compiling. This project is a great start on that subject.



        If you use the cross-compile option, pass the arguments below for a build with the features you'll need:



        ./cross_compile_ffmpeg.sh --gcc-cpu-count=12  --build-libmxf=n --disable-nonfree=n --prefer-stable=y --compiler-flavors=multi


        Note that the resulting build above is non-redistributable, and is only for personal use.



        On Linux, using the opensource mesa amdgpu driver (not the proprietary package installed from AMD), you can access VAAPI-based encoders, aptly named h264_vaapi and hevc_vaapi, whose usage can be viewed via:



        ffmpeg -h encoder=h264_vaapi

        ffmpeg -h encoder=hevc_vaapi


        To the best of my knowledge (correct me if I'm wrong), VP8 and VP9 encoding isn't exposed on AMD's side via VAAPI. You can confirm this by running:



        vainfo | grep Slice


        On your system and confirming what encoders are supported.
        It's most likely that FFmpeg with VAAPI enabled is the default on the likes of Ubuntu.
        However, you can also build a copy from source, if so needed. See the compilation guide on the FFmpeg Wiki, and adapt as needed. You may also find helpers, such as this, useful.



        There's a possibility that the AMD AMF-based encoders will eventually land on Linux, using a Vulkan-based interop. Take this as a work in progress.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 days ago









        林正浩林正浩

        31018




        31018






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1107782%2fhow-to-use-gpu-acceleration-in-ffmpeg-with-amd-radeon%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            香粉寮

            GameSpot