Process GIF using FFmpeg libraries - can't find parser at av_parser_init












0















I am playing with ffmpeg libs, namely libswscale and libavcodec for now. My goal is resize GIF files. From my ridiculous understanding, I think I need to




  • decode the GIF and get an AVFrame

  • process the frame with libswscale

  • encode again into GIF


But I am stuck at step 1. Based on official sample at https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/decode_video.c , I need to get a parser:



codec = avcodec_find_decoder(AV_CODEC_ID_GIF);
parser = av_parser_init(codec->id);


But no parser is found. I am not touching parser in my configure call, so I take all:



Enabled parsers:
aac cavsvideo dvbsub h263 mpegvideo sipr xma
aac_latm cook dvd_nav h264 opus tak
ac3 dca dvdsub hevc png vc1
adx dirac flac mjpeg pnm vorbis
av1 dnxhd g729 mlp rv30 vp3
avs2 dpx gsm mpeg4video rv40 vp8
bmp dvaudio h261 mpegaudio sbc vp9


What am I doing wrong? If this is the wrong approach, what is the correct one?










share|improve this question























  • (to close voter) How is it unclear what I am asking? I am asking why there's no parser that handles AV_CODEC_ID_GIF, but also giving context around this because the whole approach I took might be wrong for my goal. I just don't know.

    – natario
    Nov 24 '18 at 18:13













  • Maybe this helps. And docs

    – Ripi2
    Nov 24 '18 at 18:29













  • @Ripi2 thanks. But I am using ffmpeg 4.1 where this function is deprecated and is a no-op. Even if I add nothing changes. It's not clear to me which one (in the list I attached) should be the correct parser for gifs. Apparently no-one?

    – natario
    Nov 24 '18 at 18:38











  • No parser needed for GIF. The decoder parses the bitstream for the next image or extension.

    – Gyan
    Nov 24 '18 at 18:59











  • Thanks @Gyan . How to use the decoder then? I was following lines 161-171 from the official sample. Feel free to post an answer

    – natario
    Nov 24 '18 at 19:09
















0















I am playing with ffmpeg libs, namely libswscale and libavcodec for now. My goal is resize GIF files. From my ridiculous understanding, I think I need to




  • decode the GIF and get an AVFrame

  • process the frame with libswscale

  • encode again into GIF


But I am stuck at step 1. Based on official sample at https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/decode_video.c , I need to get a parser:



codec = avcodec_find_decoder(AV_CODEC_ID_GIF);
parser = av_parser_init(codec->id);


But no parser is found. I am not touching parser in my configure call, so I take all:



Enabled parsers:
aac cavsvideo dvbsub h263 mpegvideo sipr xma
aac_latm cook dvd_nav h264 opus tak
ac3 dca dvdsub hevc png vc1
adx dirac flac mjpeg pnm vorbis
av1 dnxhd g729 mlp rv30 vp3
avs2 dpx gsm mpeg4video rv40 vp8
bmp dvaudio h261 mpegaudio sbc vp9


What am I doing wrong? If this is the wrong approach, what is the correct one?










share|improve this question























  • (to close voter) How is it unclear what I am asking? I am asking why there's no parser that handles AV_CODEC_ID_GIF, but also giving context around this because the whole approach I took might be wrong for my goal. I just don't know.

    – natario
    Nov 24 '18 at 18:13













  • Maybe this helps. And docs

    – Ripi2
    Nov 24 '18 at 18:29













  • @Ripi2 thanks. But I am using ffmpeg 4.1 where this function is deprecated and is a no-op. Even if I add nothing changes. It's not clear to me which one (in the list I attached) should be the correct parser for gifs. Apparently no-one?

    – natario
    Nov 24 '18 at 18:38











  • No parser needed for GIF. The decoder parses the bitstream for the next image or extension.

    – Gyan
    Nov 24 '18 at 18:59











  • Thanks @Gyan . How to use the decoder then? I was following lines 161-171 from the official sample. Feel free to post an answer

    – natario
    Nov 24 '18 at 19:09














0












0








0








I am playing with ffmpeg libs, namely libswscale and libavcodec for now. My goal is resize GIF files. From my ridiculous understanding, I think I need to




  • decode the GIF and get an AVFrame

  • process the frame with libswscale

  • encode again into GIF


But I am stuck at step 1. Based on official sample at https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/decode_video.c , I need to get a parser:



codec = avcodec_find_decoder(AV_CODEC_ID_GIF);
parser = av_parser_init(codec->id);


But no parser is found. I am not touching parser in my configure call, so I take all:



Enabled parsers:
aac cavsvideo dvbsub h263 mpegvideo sipr xma
aac_latm cook dvd_nav h264 opus tak
ac3 dca dvdsub hevc png vc1
adx dirac flac mjpeg pnm vorbis
av1 dnxhd g729 mlp rv30 vp3
avs2 dpx gsm mpeg4video rv40 vp8
bmp dvaudio h261 mpegaudio sbc vp9


What am I doing wrong? If this is the wrong approach, what is the correct one?










share|improve this question














I am playing with ffmpeg libs, namely libswscale and libavcodec for now. My goal is resize GIF files. From my ridiculous understanding, I think I need to




  • decode the GIF and get an AVFrame

  • process the frame with libswscale

  • encode again into GIF


But I am stuck at step 1. Based on official sample at https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/decode_video.c , I need to get a parser:



codec = avcodec_find_decoder(AV_CODEC_ID_GIF);
parser = av_parser_init(codec->id);


But no parser is found. I am not touching parser in my configure call, so I take all:



Enabled parsers:
aac cavsvideo dvbsub h263 mpegvideo sipr xma
aac_latm cook dvd_nav h264 opus tak
ac3 dca dvdsub hevc png vc1
adx dirac flac mjpeg pnm vorbis
av1 dnxhd g729 mlp rv30 vp3
avs2 dpx gsm mpeg4video rv40 vp8
bmp dvaudio h261 mpegaudio sbc vp9


What am I doing wrong? If this is the wrong approach, what is the correct one?







c++ ffmpeg gif libavcodec swscale






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 24 '18 at 17:50









natarionatario

17.2k967130




17.2k967130













  • (to close voter) How is it unclear what I am asking? I am asking why there's no parser that handles AV_CODEC_ID_GIF, but also giving context around this because the whole approach I took might be wrong for my goal. I just don't know.

    – natario
    Nov 24 '18 at 18:13













  • Maybe this helps. And docs

    – Ripi2
    Nov 24 '18 at 18:29













  • @Ripi2 thanks. But I am using ffmpeg 4.1 where this function is deprecated and is a no-op. Even if I add nothing changes. It's not clear to me which one (in the list I attached) should be the correct parser for gifs. Apparently no-one?

    – natario
    Nov 24 '18 at 18:38











  • No parser needed for GIF. The decoder parses the bitstream for the next image or extension.

    – Gyan
    Nov 24 '18 at 18:59











  • Thanks @Gyan . How to use the decoder then? I was following lines 161-171 from the official sample. Feel free to post an answer

    – natario
    Nov 24 '18 at 19:09



















  • (to close voter) How is it unclear what I am asking? I am asking why there's no parser that handles AV_CODEC_ID_GIF, but also giving context around this because the whole approach I took might be wrong for my goal. I just don't know.

    – natario
    Nov 24 '18 at 18:13













  • Maybe this helps. And docs

    – Ripi2
    Nov 24 '18 at 18:29













  • @Ripi2 thanks. But I am using ffmpeg 4.1 where this function is deprecated and is a no-op. Even if I add nothing changes. It's not clear to me which one (in the list I attached) should be the correct parser for gifs. Apparently no-one?

    – natario
    Nov 24 '18 at 18:38











  • No parser needed for GIF. The decoder parses the bitstream for the next image or extension.

    – Gyan
    Nov 24 '18 at 18:59











  • Thanks @Gyan . How to use the decoder then? I was following lines 161-171 from the official sample. Feel free to post an answer

    – natario
    Nov 24 '18 at 19:09

















(to close voter) How is it unclear what I am asking? I am asking why there's no parser that handles AV_CODEC_ID_GIF, but also giving context around this because the whole approach I took might be wrong for my goal. I just don't know.

– natario
Nov 24 '18 at 18:13







(to close voter) How is it unclear what I am asking? I am asking why there's no parser that handles AV_CODEC_ID_GIF, but also giving context around this because the whole approach I took might be wrong for my goal. I just don't know.

– natario
Nov 24 '18 at 18:13















Maybe this helps. And docs

– Ripi2
Nov 24 '18 at 18:29







Maybe this helps. And docs

– Ripi2
Nov 24 '18 at 18:29















@Ripi2 thanks. But I am using ffmpeg 4.1 where this function is deprecated and is a no-op. Even if I add nothing changes. It's not clear to me which one (in the list I attached) should be the correct parser for gifs. Apparently no-one?

– natario
Nov 24 '18 at 18:38





@Ripi2 thanks. But I am using ffmpeg 4.1 where this function is deprecated and is a no-op. Even if I add nothing changes. It's not clear to me which one (in the list I attached) should be the correct parser for gifs. Apparently no-one?

– natario
Nov 24 '18 at 18:38













No parser needed for GIF. The decoder parses the bitstream for the next image or extension.

– Gyan
Nov 24 '18 at 18:59





No parser needed for GIF. The decoder parses the bitstream for the next image or extension.

– Gyan
Nov 24 '18 at 18:59













Thanks @Gyan . How to use the decoder then? I was following lines 161-171 from the official sample. Feel free to post an answer

– natario
Nov 24 '18 at 19:09





Thanks @Gyan . How to use the decoder then? I was following lines 161-171 from the official sample. Feel free to post an answer

– natario
Nov 24 '18 at 19:09












0






active

oldest

votes











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%2f53460876%2fprocess-gif-using-ffmpeg-libraries-cant-find-parser-at-av-parser-init%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















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%2f53460876%2fprocess-gif-using-ffmpeg-libraries-cant-find-parser-at-av-parser-init%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

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)