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

Optimization - Don't write when there's no modified metadata #151

Open
Zeugma440 opened this issue May 25, 2022 · 6 comments
Open

Optimization - Don't write when there's no modified metadata #151

Zeugma440 opened this issue May 25, 2022 · 6 comments

Comments

@Zeugma440
Copy link
Owner

Prevent modifying files on Track.Save, if the metadata has not changed

@sandreas
Copy link
Contributor

Cool to see that is regarded now. Maybe it would be nice to keep a possibility to force a save under specific circumstances.

mp4v2 has a tool mp4tag with a parameter --optimize, which does some black magic voodoo to optimize the structure of mp4 containers. I don't know, if this is a good idea, but maybe ForceSave or SaveOptimized is an option for Track.

@Zeugma440
Copy link
Owner Author

mp4v2 has a tool mp4tag with a parameter --optimize, which does some black magic voodoo to optimize the structure of mp4 containers. I don't know, if this is a good idea, but maybe ForceSave or SaveOptimized is an option for Track.

I agree with you about the need for a "force save" option, but I have no idea what kind of "black magic" that tool does to optimize files. Is there any spec or description about that ?

@sandreas
Copy link
Contributor

sandreas commented Jun 6, 2022

Thank you for taking a look.

Is there any spec or description about that ?

Yes, here. @enzo1982 took a huge effort create a documentation, see https://mp4v2.org

@item --optimize
optimize mp4 structure.
This will rewrite the entire mp4 file which, if needed, will clean up
any unused (free) sections, and re-order the atoms in a manner somewhat
consistent with the best-practices described in the ISO base media file
specification.

I think, that the optimization is not necessary until it is really requested. Maybe this would be good for files like #152 and should be called --repair. But for now I think this would be nice-to-have and can be ignored. I think atldotnet is awesome, but not a forensic tool responsible fix user errors or bogus files created by other software.

@Zeugma440
Copy link
Owner Author

I've been implementing that and just realized the client-side impacts are much more important than I thought.

Many "advanced" features of ATL are not triggered by the content of the metadata you're writing but by values you switch on and off using ATL.Settings.

Example 1 : Convert ID3v2.4 to ID3v2.3
Example 2 : Cap the number of Nero chapters to 255 to make them readable on VLC
Example 3 : Save all chapters as QT chapters instead of Nero Chapters
(the list goes on...)

All these features need to update the file even if metadata itself hasn't changed at all. In other words, many use cases that currently work in a transparent manner will require "force save" to be turned on, which can lead to confusing situations when updating the library.

=> As far as retrocompatibilty goes, I'd rather make "force save" enabled by default and let people disable it when they want to focus on performance.

Would you be okay with that @sandreas ?

@sandreas
Copy link
Contributor

=> As far as retrocompatibilty goes, I'd rather make "force save" enabled by default and let people disable it when they want to focus on performance. Would you be okay with that @sandreas ?

Absolutely, I think it is very important not to break existing software by changing the default behaviour. Since I implement many things by myself (see https://github.com/sandreas/tone/blob/8066911e74302c6d6e18640c7c52f8f83da3d6f9/tone/Metadata/MetadataTrack.cs#L10), this is the perfect behaviour.

Thank you for thinking this through :-)

@sandreas
Copy link
Contributor

sandreas commented Aug 25, 2022

Developing tone I came up with an idea that would have a lot of benefits...

How about the Track class tracking the changes made to metadata in a History / UndoManager with access to original properties?

Maybe an extension Class TrackableTrack ;)

That would make the implementation of this feature pretty easy (no changes, no save) and you could access differences between the original and the existing without reloading the file or stream again.

What do you think?

@Zeugma440 Zeugma440 removed their assignment Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants