[Libav-user] Transcoding with new API avcodec_receive_packet
Shu Wang
halfelf.ronin at gmail.com
Thu Nov 30 05:15:25 EET 2017
The error is to tell you to set the linesize of input frame/picture, which
value is 0 and should be at least 1920 on y plane.
btw, your repo link is 404...
On Wed, Nov 29, 2017 at 9:12 PM, Leandro Moreira <
leandro.ribeiro.moreira at gmail.com> wrote:
> Hello there,
>
> I'm trying to code a simple transcoder that replicates (almost the same
> behavior) as this command line:
>
> ffmpeg -i input.mp4 -c:v libx264 -x264-params keyint=60:min-keyint=60:no-scenecut=1
> -c:a copy output.mp4
>
> In order to implement this code I used two examples I found:
>
> - https://ffmpeg.org/doxygen/trunk/transcoding_8c-example.html
> - https://ffmpeg.org/doxygen/trunk/encode_video_8c-example.html
>
> When I try to run my transcoder it doesn't produce the output and also
> shows this logging message:
>
> [libx264 @ 0x7fd99e801200] Input picture width (1920) is greater than
> stride (0)
>
> Am I missing something?
>
> *The entire code, how to compile it and run it.*
>
> https://github.com/leandromoreira/ffmpeg-libav-
> tutorial/blob/transcoding/2_transcoding.c
> <https://github.com/leandromoreira/ffmpeg-libav-tutorial/blob/transcoding/2_transcoding.ccat>
>
> gcc -g -Wall -o transcoding -lavformat -lavcodec -lswscale -lz
> 2_transcoding.c \
> && ./transcoding small_bunny_1080p_60fps.mp4 bunny_1s_gop.mp4
>
> *A summary of my code:*
>
> // a simple transcode context
> typedef struct TrancodeContext {
> char *file_name;
> AVFormatContext *format_context;
>
> int audio_stream_index;
> int video_stream_index;
>
> AVStream *stream[2];
> AVCodec *codec[2];
> AVCodecContext *codec_context[2];
> } TranscodeContext;
>
> //I use two context
> TranscodeContext *decoder = malloc(sizeof(TranscodeContext));
> TranscodeContext *encoder = malloc(sizeof(TranscodeContext));
>
> prepare_input(decoder);
> prepare_output(decoder, encoder);
>
> // decoding
> while (av_read_frame(decoder->format_context, i_packet) >= 0) {
> decode_packet();
> encode_frame();
> }
>
>
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
--
Shu. Wang @ Bestminr
http://halfelf.me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20171130/62b5915e/attachment.html>
More information about the Libav-user
mailing list