[Libav-user] Questions about transcoding h264 and h265

Leandro Moreira leandro.ribeiro.moreira at gmail.com
Sun Dec 29 15:03:01 EET 2019


Thanks Vassilis that's awesome, it worked, I just had to get the frame rate
from the decoder context but now this fps problem was fixed thanks to you
(and James)
<https://github.com/leandromoreira/ffmpeg-libav-tutorial/pull/52#issuecomment-569503206>.
I still need to figure it out how to fix all the other issues
<https://github.com/leandromoreira/ffmpeg-libav-tutorial/pull/52>.

On Sun, Dec 29, 2019 at 3:06 AM Vassilis <bpantazhs at gmail.com> wrote:

> 3) After I transcoded with my code
>> <https://github.com/leandromoreira/ffmpeg-libav-tutorial/blob/transcoding/2_transcoding.c>
>> I'm getting a 60.11 fps while the original video has fixed 60fps, why this
>> usually happens?
>>
>> While I am not able to .help you with the two first issues I think I may
> have an idea for the third. This seems like an issue I faced with my own
> attempt at transcoding video and a fix was suggested by a member of this
> mailing list (thanks James). You need to set the AVPacket duration field,
> otherwise this issue is present. This would mean adding something in the
> lines of the following line of code before your av_interleaved_write_frame
> is called:
>
> // for example, if 25 FPS, and time_base is 12800, then packet.duration =
> 12800 / 25 = 512
> output_packet.duration =
> format_context->streams[stream_index]->time_base.den /
> format_context->streams[stream_index]->time_base.num /
> format_context->streams[stream_index]->avg_frame_rate.num *
> format_context->streams[stream_index]->avg_frame_rate.den;
>
>  /* mux encoded frame */
>     ret = av_interleaved_write_frame(format_context, output_packet);
>
> Hope this helps!
>
> Vas
>
>
>
> _______________________________________________
> 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/20191229/60beaa1c/attachment.html>


More information about the Libav-user mailing list