-
Notifications
You must be signed in to change notification settings - Fork 30
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
set_duration() #25
Comments
I now see audiotags/src/components/flac_tag.rs Lines 8 to 40 in 2fa3f6c
Which I tried to use via fn set_duration(file: &Path, duration: f64) {
use audiotags::*;
let tag = Tag::new().read_from_path(file).unwrap();
let mut any_tag = tag.to_anytag();
any_tag.duration = Some(duration);
let mut flac_tag: FlacTag = any_tag.into();
flac_tag
.write_to_path(file.to_str().unwrap())
.expect("Fail to save");
} But that still does not work because So I ask again, why does this library have no method for setting the duration? |
I see audiotags/src/components/flac_tag.rs Lines 127 to 131 in 2fa3f6c
Is returned from dividing the number of samples from the sample rate s.total_samples as f64 / f64::from(s.sample_rate) So it might make since that you can't set duration directly. That being said, my file's |
ffmpeg seems to be able to do that via https://stackoverflow.com/questions/60653531/ffmpeg-flac-audio-file-duration-in-metadata-is-0 |
I see Trait audiotags::traits::AudioTagEdit provides duration() but no way to edit it.
And Struct audiotags::anytag::AnyTag provides a mutable duration field but no way to write an
AnyTag
back to a file.How can I assign a value to a file's duration metadata?
The text was updated successfully, but these errors were encountered: