[Libav-user] creating a basic live transcoder

Paul B Mahol onemda at gmail.com
Mon Jan 2 23:01:41 EET 2023


On Mon, Jan 2, 2023 at 9:48 PM Luis Felipe Domínguez Vega via Libav-user <
libav-user at ffmpeg.org> wrote:

> Found the best documentation about ffmpeg outside ffmpeg.
>
>
> https://github.com/leandromoreira/ffmpeg-libav-tutorial#chapter-1---syncing-audio-and-video
>
> There is well explained the PTS definition very very well. Used the
> calculations from that readme and set this:
>
> ```
>          packet->pts = dvCodecCtx->time_base.den /
> av_q2d(dvCodecCtx->framerate) *  frameCounter++;
>
> ```
>
> Now the input stream can restart, get wrong PTS, TS, whatever that dont
> broke my output stream timing.
>

Technically speaking that line is pure hack as it does use double floating
point precision for calculations when it is not really needed to use and
may after some relative long time give bad results.


> On 1/2/23 16:39, Luis Felipe Domínguez Vega via Libav-user wrote:
> > Hi, I'm trying to create in C a basic live transcoder that use my
> > NVidia for hardware transcoding. I trying to set the decoded frame PTS
> > to my own because the source of the video is a UDP stream and can be
> > restarted. So i want manage by myself the PTS value to avoid a restart
> > of that value.
> >
> > Really i dont found a good documentation about to how manage and
> > create from 0 that PTS value.
> >
> > Right now iw geting the frame from decoder, "modify ->pts", and send
> > to encoder, only for testing i get a variable with "frame" counter
> > that start at 0, tested this:
> >
> > ```
> > frame->pts = frameCounter++
> > ```
> >
> > Of course this, after video encoder completed, drop so many frames on
> > the player (codec is h264 at input and output). So i think that i dont
> > geting the idea behind pts.
> >
> > _______________________________________________
> > 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".
> _______________________________________________
> 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/20230102/190de9c7/attachment.htm>


More information about the Libav-user mailing list