[Libav-user] C++ Decoder Example Does not work with h264/h265 BigBuckBunny

Jie Zhang wangyoucao577 at gmail.com
Sat Jun 11 11:58:37 EEST 2022


The decode example(
https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/doc/examples/decode_video.c)
intend to decode raw stream rather than muxed .mp4 file.

You may better to follow the input part of the transcoder example(
https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/doc/examples/transcoding.c)
to use `avformat_open_input/avcodec_find_decoder` for demuxer/decoder
initializing, then use `av_read_frame` to get demuxed frame, after that
same logic in decode/transcode example to use
`avcodec_send_packet/avcodec_receive_frame` for decoding. Output part of
the transcode example could be ignored if you don't need it.


On Fri, Jun 10, 2022 at 3:54 PM Kanzler Mike <halcom at gmx.de> wrote:

> Hi,
>
> i want to use ffmpeg/libav to decode h264/h265 videos (sound not needed)
> on Windows 10, Visual Studio 2019.
>
> I used the precompiled Windows Libraries from gyan.dev (latest release
> 5.0.1 Full).
> As example videos i used the
> https://test-videos.co.uk/bigbuckbunny/mp4-h264 in 1280x720 (and also the
> h256 version).
>
> I think i have to change the codec to:
>
> codec = avcodec_find_decoder(AV_CODEC_ID_H264);
>
>
> My problem is that the av_parser_parse2 method seems not to find a packet
> or loads the whole file as one packet which i cant decode.
>
> I tried other codec like
>
> AV_CODEC_ID_MPEG4,
>
> AV_CODEC_ID_HEVC,
>
> AV_CODEC_ID_H265
>
>
> None of that works for me. I also used an older version off ffmpeg that i
> used for video encoding years before, that also wont work.
>
> What did i miss? Or is this a bug?
>
> Best Regards
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20220611/2bce4348/attachment.htm>


More information about the Libav-user mailing list