Skip to content

Don't copy chapters into split export files #2176

Description

@yuchenshi

The fewer issues I have to read, the more new features I will have time to implement, so I ask that you please try these things first

Description

I like how Lossless-Cut imports embedded MP4 chapters from the source file automatically, but when I try to export the segments as individual files, I'm surprised to find out that chapter markers are copied into each file.

This feature request is about not copying the chapter markers (or at least having an option for skipping those) and my rationale follows.

Due to the inexact nature of cutting, the resulting chapters are quite misleading in most of the cases. For example, when the source file contains Chapter 1-5, the resulting file chapter4.mp4 will usually end up having:

  1. A few seconds at the start of the video, marked as "Chapter 3"
  2. The actual intended contents of Chapter 4, marked as such
  3. [Sometimes] 1-2 seconds at the end of the video, marked as "Chapter 5"

I'm not asking to remove the extra seconds and I understand that they're due to key frames seeking. The extra seconds themselves don't bother me, but I find the 1-2 bogus chapters annoying in video players. For example, they show up in VLC timeline and enables chapter seeking. (If one were to modify the segment start/end, the embedded chapters may be even more confusing since they are stuck to the original video.)


Diving into the implementation, I did a bit research and found that adding -map_chapters -1 to the ffmpeg command line worked just fine and removed the chapters for me. I believe the fact that chapters are copied in the first place is due to -map_metadata implying chapters as well, so appending -map_chapters -1 that negates that. This of course only matters for split imports and "Chapters only" mode shouldn't be changed.

The problem is that I still need to run Lossless Cut export and wait for all the segments to be written, and then go to the menu logs, copy the commands and add the flag to them one by one, and then finally run those again to overwrite the files. I've searched the menus, options, and issue list but haven't found a way to add custom flags to ffmpeg. The only thing I can think of is to use the Developer Tools to modify the command line on a break point, which quickly becomes tedious for each segment. (I've also searched the issues for map_chapters but couldn't find any similar issue. I've also searched for map_metadata and I understand it's needed for copying over other metadata and I think copying chapters is just probably an unintended consequence. I believe I've done my due diligence but let me know if I've missed anything.)

Let me know if this sounds reasonable and I'm happy to send PRs and/or dive into more discussions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions