Alex,

I was trying the suggested approach and got a crash:

#1 column -> timestamp_ms since beginning of recording
#2 column -> av_rescale_q(timestamp, AVRational{1, 1000}, ost->st->time_base) 
where ost->st->time_base = { 1, _fps };            
#3 column -> next_pts++ (frame)

325 4992 1
359 5514 2
392 6021 3
421 6467 4
457 7020 5
485 7450 6
523 8033 7
559 8586 8
587 9016 9
626 9615 10
657 10092 11
690 10598 12
724 11121 13
759 11658 14

// CRASH
[mp4 @ 0x7fa647808200] pts (4616192) < dts (4639744) in stream 0

What could possibly be wrong?

Thanks!

Nuno

> On 2 Sep 2021, at 17:05, Nuno Santos <[email protected]> wrote:
> 
> Alex,
> 
> Thanks for your reply.
> 
> This means that if I have a recording elapsed timer, I could pass the 
> timestamp at the current recording time to make this? Or do you seen any 
> other better way of doing it?
> 
> Right now, the pts is being defined as:
> 
> ost->frame->pts = ost->next_pts++;
> 
> Has per muxing.c example
> 
> Regards,
> 
> Nuno
> 
>> On 2 Sep 2021, at 13:43, Alexandr Kasyan <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> Hi, Nuno!
>> 
>> Well, one of the possible approaches is -- set the proper pts for AVPacket-s 
>> you're muxing. 
>> The basic formula is: 
>> uint64_t pts = av_rescale_q(timestamp_ms, AVRational{1, 1000}, time_base);
>> 
>> It's usually time or PTS that's specified for packets (and frame's time is 
>> usually derived from that), so most of the players take that into account 
>> when feeding frames for display. 
>> You can check if your muxing is played at the wrong speed in the first 
>> place, then adjust PTS in code if needed.
>> __________________________________________
>> 
>> Regards, Alex
>> _______________________________________________
>> Libav-user mailing list
>> [email protected] <mailto:[email protected]>
>> https://ffmpeg.org/mailman/listinfo/libav-user
>> 
>> To unsubscribe, visit link above, or email
>> [email protected] with subject "unsubscribe".
> 

_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to