[Libav-user] creating a basic live transcoder

Luis Felipe Domínguez Vega ldominguez at boldmss.com
Mon Jan 2 22:48:18 EET 2023


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.

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".


More information about the Libav-user mailing list