[FFmpeg-devel] [PATCH] avformat/segment: fix cuttting for non-zero start pts

Marton Balint cus at passwd.hu
Fri Nov 1 18:58:46 EET 2019



On Thu, 31 Oct 2019, Vasily wrote:

> Hi Marton,
>
>> Please use a proper commit title: e.g:
>>
>> avformat/segment: fix non-zero start pts
>>
>> Also make sure you provide the author name you want when you send the
>> patch email. (you only provided an email address in the From field, not a
>> full name, I guess this is not intentional).
>
> I've fixed "From" and subject (so it's just my first name, I don't want to share my family name etc), hope it's okay now (or do I need to send a completely new patch with fixed From and subject instead?).

Yes, you should send a new patch.

>
>
>> What happens if the first packet is not from a reference stream? As far as
>> I see in that case the output packet timestamp will be 0 based until we
>> get a packet from the refence stream... Maybe you should accept a packet
>> from any stream here?
>
> I am not changing output packet timestamps here, I only change the way 
> the cutting point for segment muxer is calculated.

You are setting these:

+                seg->cur_entry.start_time = (double)pkt->pts * av_q2d(st->time_base);
+                seg->cur_entry.start_pts = seg->start_pts;

These can affect the packet PTSes of the first segment, because later 
there is code like this:

     /* compute new timestamps */
     offset = av_rescale_q(seg->initial_offset - (seg->reset_timestamps ? seg->cur_entry.start_pts : 0),
                           AV_TIME_BASE_Q, st->time_base);
     if (pkt->pts != AV_NOPTS_VALUE)
         pkt->pts += offset;
     if (pkt->dts != AV_NOPTS_VALUE)
         pkt->dts += offset;

Regards,
Marton


More information about the ffmpeg-devel mailing list