Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't copy chapters into split export files #2176

Closed
4 tasks done
yuchenshi opened this issue Oct 2, 2024 · 9 comments
Closed
4 tasks done

Don't copy chapters into split export files #2176

yuchenshi opened this issue Oct 2, 2024 · 9 comments

Comments

@yuchenshi
Copy link

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.

@yuchenshi
Copy link
Author

I also just want to say thank you so much for this project. Lossless Cut has helped me countless times with my video editing and the project is still amazing despite this small issue. I've sponsored but it's not a bounty for this issue or anything like that -- no pressure at all.

@mifi mifi closed this as completed in 8024884 Oct 7, 2024
@mifi
Copy link
Owner

mifi commented Oct 7, 2024

i've added a button to disable chapters output, thanks!

@TarkusLV
Copy link

Where is that button located? I can't seem to find it.

@mifi
Copy link
Owner

mifi commented Oct 20, 2024

under "Export options". you can enable this dialog in the bottom right:
Screenshot 2024-10-20 at 20 33 33

@TarkusLV
Copy link

Yes, I have that button enabled, but I see no option to disable chapters on export.

@mifi
Copy link
Owner

mifi commented Oct 20, 2024

are you running v3.63.0? it's called "preserve chapters"

Screenshot 2024-10-20 at 21 34 24

@TarkusLV
Copy link

Yeah, I don't have that option.
Screenshot (20)

@mifi
Copy link
Owner

mifi commented Oct 20, 2024

oops that's a bug. seems I only enabled that option for MOV/MP4 files, will fix. as a workaround you can open a mov/mp4 file, then change the setting, then open your file again

mifi added a commit that referenced this issue Oct 20, 2024
@TarkusLV
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants