libav: where to get a reference to AV_PIX_FMT_NV12 when using cuda/cuvid?What are the differences and similarities between ffmpeg, libav, and avconv?libav/ffmpeg: avcodec_decode_video2() returns -1 when separating demultiplexing and decodingRGB-frame encoding - FFmpeg/libavConverting RGB frames to YUV420P using FFmpeg/C++Transcode of H.264 to VP8 using libav* has incorrect frame rateData loss while converting from jpeg to BGRA using ffmpegFFMPEG API — How much do stream parameters change frame-to-frame?Saving raw YUV420P frame FFmpeg/LibavLibav (ffmpeg) copying decoded video timestamps to encoderLibAV converting a streaming audio file to PCM

LINQ Extension methods MinBy and MaxBy

Where should I draw the line on follow up questions from previous employer

How to query field names from custom object by data type?

Break down the phrase "shitsurei shinakereba naranaindesu"

Questions about Noun+が+Adjective

What is this "opened" cube called?

Why haven't the British protested Brexit as ardently as the Hong Kong protesters?

Large molecule dataset

Can authors email you PDFs of their textbook for free?

Colored grid with coordinates on all sides?

How do I get my neighbour to stop disturbing with loud music?

Create a list of snaking numbers under 50,000

Sum and average calculator

Divide Numbers by 0

Given a specific computer system, is it possible to estimate the actual precise run time of a piece of Assembly code

When you have to wait for a short time

Ways you can end up paying interest on a credit card if you pay the full amount back in due time

How can I store milk for long periods of time?

Can I leave a large suitcase at TPE during a 4-hour layover, and pick it up 4.5 days later when I come back to TPE on my way to Taipei downtown?

Should a TA point out a professor's mistake while attending their lecture?

Is Borg adaptation only temporary?

How smart contract transactions work?

How to load files as a quickfix window at start-up

Can two aircraft be allowed to stay on the same runway at the same time?



libav: where to get a reference to AV_PIX_FMT_NV12 when using cuda/cuvid?


What are the differences and similarities between ffmpeg, libav, and avconv?libav/ffmpeg: avcodec_decode_video2() returns -1 when separating demultiplexing and decodingRGB-frame encoding - FFmpeg/libavConverting RGB frames to YUV420P using FFmpeg/C++Transcode of H.264 to VP8 using libav* has incorrect frame rateData loss while converting from jpeg to BGRA using ffmpegFFMPEG API — How much do stream parameters change frame-to-frame?Saving raw YUV420P frame FFmpeg/LibavLibav (ffmpeg) copying decoded video timestamps to encoderLibAV converting a streaming audio file to PCM






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








0















Say I'm using av_hwdevice_find_type_by_name("cuda"), as in here. I need to convert the decoded frames to RGB using a SwsContext. I know, by experience, that when using the cuda/cuvid decoder I get frames in the AV_PIX_FMT_NV12 format, even though every struct I look at says either AV_PIX_FMT_NONE or AV_PIX_FMT_YUV420P.



On what field of what struct can I get the AV_PIX_FMT_NV12 value so I can remove my hardcoded source format on my call to SwsContext.sws_scale? Thanks!



Update:



Looks like I can get it by:



AVCodecContext* avctx;
...
frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
AVPixelFormat pixel_fmt = frames_ctx->sw_format;


...once at least one frame has been decoded. Not sure if it's the correct way though.










share|improve this question
































    0















    Say I'm using av_hwdevice_find_type_by_name("cuda"), as in here. I need to convert the decoded frames to RGB using a SwsContext. I know, by experience, that when using the cuda/cuvid decoder I get frames in the AV_PIX_FMT_NV12 format, even though every struct I look at says either AV_PIX_FMT_NONE or AV_PIX_FMT_YUV420P.



    On what field of what struct can I get the AV_PIX_FMT_NV12 value so I can remove my hardcoded source format on my call to SwsContext.sws_scale? Thanks!



    Update:



    Looks like I can get it by:



    AVCodecContext* avctx;
    ...
    frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
    AVPixelFormat pixel_fmt = frames_ctx->sw_format;


    ...once at least one frame has been decoded. Not sure if it's the correct way though.










    share|improve this question




























      0












      0








      0


      0






      Say I'm using av_hwdevice_find_type_by_name("cuda"), as in here. I need to convert the decoded frames to RGB using a SwsContext. I know, by experience, that when using the cuda/cuvid decoder I get frames in the AV_PIX_FMT_NV12 format, even though every struct I look at says either AV_PIX_FMT_NONE or AV_PIX_FMT_YUV420P.



      On what field of what struct can I get the AV_PIX_FMT_NV12 value so I can remove my hardcoded source format on my call to SwsContext.sws_scale? Thanks!



      Update:



      Looks like I can get it by:



      AVCodecContext* avctx;
      ...
      frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
      AVPixelFormat pixel_fmt = frames_ctx->sw_format;


      ...once at least one frame has been decoded. Not sure if it's the correct way though.










      share|improve this question
















      Say I'm using av_hwdevice_find_type_by_name("cuda"), as in here. I need to convert the decoded frames to RGB using a SwsContext. I know, by experience, that when using the cuda/cuvid decoder I get frames in the AV_PIX_FMT_NV12 format, even though every struct I look at says either AV_PIX_FMT_NONE or AV_PIX_FMT_YUV420P.



      On what field of what struct can I get the AV_PIX_FMT_NV12 value so I can remove my hardcoded source format on my call to SwsContext.sws_scale? Thanks!



      Update:



      Looks like I can get it by:



      AVCodecContext* avctx;
      ...
      frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
      AVPixelFormat pixel_fmt = frames_ctx->sw_format;


      ...once at least one frame has been decoded. Not sure if it's the correct way though.







      ffmpeg libav






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 0:11







      Simon Labrecque

















      asked Mar 27 at 21:30









      Simon LabrecqueSimon Labrecque

      4176 silver badges11 bronze badges




      4176 silver badges11 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          0















          As for CUDA, your best bet will be when see AV_PIX_FMT_YUV420P on AVHWFramesContext::sw_format consider it as AV_PIX_FMT_NV12 and when AV_PIX_FMT_YUV420P10 it is actually AV_PIX_FMT_P010.



          As far as I know, neither CUDA nor NVDEC(was CUVID) support anything other than 420 format as decoded frames.






          share|improve this answer

























          • That's basically what I'm already doing and what I want to avoid (eg, assuming something based on prior knowledge). But see my update above, I can actually get the AV_PIX_FMT_NV12 at runtime now. Just wondering if it's the correct/universal way.

            – Simon Labrecque
            Mar 29 at 18:33











          • Perhaps after decoding, what you did is correct way. I was assuming before decoding.

            – the kamilz
            Apr 1 at 7:11










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          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%2fstackoverflow.com%2fquestions%2f55386758%2flibav-where-to-get-a-reference-to-av-pix-fmt-nv12-when-using-cuda-cuvid%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









          0















          As for CUDA, your best bet will be when see AV_PIX_FMT_YUV420P on AVHWFramesContext::sw_format consider it as AV_PIX_FMT_NV12 and when AV_PIX_FMT_YUV420P10 it is actually AV_PIX_FMT_P010.



          As far as I know, neither CUDA nor NVDEC(was CUVID) support anything other than 420 format as decoded frames.






          share|improve this answer

























          • That's basically what I'm already doing and what I want to avoid (eg, assuming something based on prior knowledge). But see my update above, I can actually get the AV_PIX_FMT_NV12 at runtime now. Just wondering if it's the correct/universal way.

            – Simon Labrecque
            Mar 29 at 18:33











          • Perhaps after decoding, what you did is correct way. I was assuming before decoding.

            – the kamilz
            Apr 1 at 7:11















          0















          As for CUDA, your best bet will be when see AV_PIX_FMT_YUV420P on AVHWFramesContext::sw_format consider it as AV_PIX_FMT_NV12 and when AV_PIX_FMT_YUV420P10 it is actually AV_PIX_FMT_P010.



          As far as I know, neither CUDA nor NVDEC(was CUVID) support anything other than 420 format as decoded frames.






          share|improve this answer

























          • That's basically what I'm already doing and what I want to avoid (eg, assuming something based on prior knowledge). But see my update above, I can actually get the AV_PIX_FMT_NV12 at runtime now. Just wondering if it's the correct/universal way.

            – Simon Labrecque
            Mar 29 at 18:33











          • Perhaps after decoding, what you did is correct way. I was assuming before decoding.

            – the kamilz
            Apr 1 at 7:11













          0














          0










          0









          As for CUDA, your best bet will be when see AV_PIX_FMT_YUV420P on AVHWFramesContext::sw_format consider it as AV_PIX_FMT_NV12 and when AV_PIX_FMT_YUV420P10 it is actually AV_PIX_FMT_P010.



          As far as I know, neither CUDA nor NVDEC(was CUVID) support anything other than 420 format as decoded frames.






          share|improve this answer













          As for CUDA, your best bet will be when see AV_PIX_FMT_YUV420P on AVHWFramesContext::sw_format consider it as AV_PIX_FMT_NV12 and when AV_PIX_FMT_YUV420P10 it is actually AV_PIX_FMT_P010.



          As far as I know, neither CUDA nor NVDEC(was CUVID) support anything other than 420 format as decoded frames.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 29 at 13:48









          the kamilzthe kamilz

          9121 gold badge8 silver badges13 bronze badges




          9121 gold badge8 silver badges13 bronze badges















          • That's basically what I'm already doing and what I want to avoid (eg, assuming something based on prior knowledge). But see my update above, I can actually get the AV_PIX_FMT_NV12 at runtime now. Just wondering if it's the correct/universal way.

            – Simon Labrecque
            Mar 29 at 18:33











          • Perhaps after decoding, what you did is correct way. I was assuming before decoding.

            – the kamilz
            Apr 1 at 7:11

















          • That's basically what I'm already doing and what I want to avoid (eg, assuming something based on prior knowledge). But see my update above, I can actually get the AV_PIX_FMT_NV12 at runtime now. Just wondering if it's the correct/universal way.

            – Simon Labrecque
            Mar 29 at 18:33











          • Perhaps after decoding, what you did is correct way. I was assuming before decoding.

            – the kamilz
            Apr 1 at 7:11
















          That's basically what I'm already doing and what I want to avoid (eg, assuming something based on prior knowledge). But see my update above, I can actually get the AV_PIX_FMT_NV12 at runtime now. Just wondering if it's the correct/universal way.

          – Simon Labrecque
          Mar 29 at 18:33





          That's basically what I'm already doing and what I want to avoid (eg, assuming something based on prior knowledge). But see my update above, I can actually get the AV_PIX_FMT_NV12 at runtime now. Just wondering if it's the correct/universal way.

          – Simon Labrecque
          Mar 29 at 18:33













          Perhaps after decoding, what you did is correct way. I was assuming before decoding.

          – the kamilz
          Apr 1 at 7:11





          Perhaps after decoding, what you did is correct way. I was assuming before decoding.

          – the kamilz
          Apr 1 at 7:11








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • 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%2fstackoverflow.com%2fquestions%2f55386758%2flibav-where-to-get-a-reference-to-av-pix-fmt-nv12-when-using-cuda-cuvid%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

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript