[FFmpeg-user] Towards better trims & concatenations

Mark Filipak markfilipak.imdb at gmail.com
Mon Jan 8 14:07:16 EET 2024


On 1/8/24 00:34, Andrew Randrianasulu wrote:
> пн, 8 янв. 2024 г., 07:02 Mark Filipak <markfilipak.imdb at gmail.com>:

> I think some of Mark's problems might steam from fact he apparently cuts
> blu-ray transport stream, not something commonly cut with ffmpeg.

Yes, but not quite true. I'm cutting, '-ss 20.062', but remuxing to mp4, not m2ts. So I'm not really 
cutting the MPEG-TS stream.

Unfortunately, the mp4s that ffmpeg makes are too different from the m2ts. They have new DTSs & 
PTSs, and whatever the problem is that ignores '-bsf:a setts=time_base=1/90000' is not ignored in 
the mp4s.

00395.m2ts --cut--> 01.mp4
00305.m2ts --> 00.mp4 --cut--> 01.mp4

The two versions of 01.mp4 are very different. FFmpeg is making too many changes. Its changes are 
unnecessary and, in this case, detrimental. In this case, I'm trying to test how badly ffmpeg is 
making the cut, and all the changes are making that practically impossible.

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.

I have to stick with m2ts but I have to cut it down to just 34.076 seconds. I need to do that 
without altering the internals of the packets

> there is tsMuxer, it seems to have is own logic for dealing with mpeg
> transport streams.
> 
> https://github.com/justdan96/tsMuxer
> 
> 
> There is also another  libav* based cutter VidCut
> 
> https://github.com/kanehekili/VideoCut

Thank you, Andrew. I'll take a look at them.

> May be stream is ... slightly broken in some way? Even costly pro software
> at some version can produce slightly ... confusing stream.

The m2ts is definitely strange in some way -- ffmpeg complains about the audio streams for example 
-- and it's doubly strange because the video is a Criterion movie.



More information about the ffmpeg-user mailing list