[FFmpeg-user] Towards better trims & concatenations

Mark Filipak markfilipak.imdb at gmail.com
Mon Jan 8 14:36:51 EET 2024


On 1/8/24 07:16, Rob Hallam wrote:
> On Mon, 8 Jan 2024 at 12:07, Mark Filipak <markfilipak.imdb at gmail.com> wrote:
> 
>> For example, if 'v' (video) and 'a' (audio) packets go from
>> v-a-a-a-a-v-a-a-a-a-v... to
>> a-a-a-a-a-a-a-a-v-v-v..., then somethings wrong, eh? That's the kind of difference I'm seeing
>> between the two versions of 01.mp4.
> 
> Forgive me for jumping in in the middle here, but is that strictly
> true? Honest question, perhaps the spec says that they should be
> identical.

Sorry, I don't understand you. Are you asking if I'm lying? I doubt it, but I don't know the 
antecedent of "that". Also, when you wrote "the spec", what spec did you have in mind?

> In much the same way a*b*c is equivalent to b*a*c, does the order of
> packets necessarily matter if the output is perceptually the same?

The packets are in PTS order. Does the order of the packets matter? No, it's the order of the PTSs 
that matters.

> If the output is not perceptually the same, or there are timing issues
> / desync / other problems as a result then I can see that being a
> potentially important bug.

The MPV player misbehaves for all 6 of the sons. The starting running time is not "00:00:00.000".

> Cheers,
> Rob
> 
> PS I've been following along as I am also interested in cutting and
> re-joining- my first query to this ML was about whether there's a way
> to chop off the starts and ends of some clips, add transitions and
> re-encode those short overlapping bits, and then join them back on to
> their parent clips to avoid having to re-encode the whole lot

You should be able to do all that without recoding except for the transitions, as you wrote. I and 
others have had lots of problems with concats. There are 3 concat methods. They all have problems 
with cuts. I think the real problem is deep inside ffmpeg affecting how the packet table is built 
and/or accessed.




More information about the ffmpeg-user mailing list