[Libav-user] Transcoding with new API avcodec_receive_packet

Leandro Moreira leandro.ribeiro.moreira at gmail.com
Thu Nov 30 12:40:19 EET 2017


Thanks, Shu, by the way here the correct link
https://github.com/leandromoreira/ffmpeg-libav-tutorial/blob/transcoding/2_transcoding.c

I'm trying to work with the minimal possible code since it's supposed to be
a simple example. Anyway, I'll try to set the linesize for Y channel
<https://ffmpeg.org/doxygen/trunk/structAVFrame.html#aa52bfc6605f6a3059a0c3226cc0f6567>
.

On Thu, Nov 30, 2017 at 1:24 AM Shu Wang <halfelf.ronin at gmail.com> wrote:

> 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
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20171130/553fb332/attachment.html>


More information about the Libav-user mailing list