-
-
Notifications
You must be signed in to change notification settings - Fork 55
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Reproducer
I tried this code:
match Probe::open("test.opus")?.read() {
Ok(mut tagged_file) => {
let tag = match tagged_file.primary_tag_mut() {
Some(primary_tag) => primary_tag,
None => {
if let Some(first_tag) = tagged_file.first_tag_mut() {
first_tag
} else {
let tag_type = tagged_file.primary_tag_type();
tagged_file.insert_tag(Tag::new(tag_type));
tagged_file.primary_tag_mut().unwrap()
}
}
};
let mut picture =
Picture::from_reader(&mut File::open("pic.png").context("failed to open picture")?)
.context("failed to create Picture")?;
picture.set_pic_type(PictureType::CoverFront);
tag.remove_picture_type(PictureType::CoverFront);
tag.push_picture(picture);
tag.save_to_path("test.opus")?;
}
Err(e) => eprintln!("{e}"),
};The program ended without any errors, but opusinfo shows warnings of holes in data and playback has some missing seconds.
Summary
I tried to add a PNG as CoverFront to the opus file. This results in the file being corrupted and unplayable in music players. Playback in VLC shows the first few seconds missing or corrupted and the picture being embedded.
Audio file is .opus and picture is a PNG.
Oh and thanks for the library, its really good!
Expected behavior
Picture to be embedded without corrupting the stream
Assets
opusinfo output
New logical stream (#1, serial: 0b03ae00): type opus
Encoded with Lavf59.16.100
User comments section follows...
LANGUAGE=eng
ENCODER=Lavf59.16.100
TITLE=Crossing Field
ARTIST=LiSA
ALBUM=Sword Art Online
METADATA_BLOCK_PICTURE=3|image/png||1280x720x24|<416239 bytes of image data>
WARNING: Hole in data (107 bytes) found at approximate offset 558000 bytes. Corrupted Ogg.
WARNING: Hole in data (219 bytes) found at approximate offset 558000 bytes. Corrupted Ogg.
WARNING: Hole in data (45 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (394 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (41 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (72 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (14 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (25 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (1022 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (336 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (278 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (603 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (208 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (93 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (444 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (31 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (218 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (137 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (286 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (56 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (197 bytes) found at approximate offset 562500 bytes. Corrupted Ogg.
WARNING: Hole in data (331 bytes) found at approximate offset 567000 bytes. Corrupted Ogg.
WARNING: Hole in data (287 bytes) found at approximate offset 567000 bytes. Corrupted Ogg.
WARNING: Hole in data (400 bytes) found at approximate offset 567000 bytes. Corrupted Ogg.
WARNING: Hole in data (34 bytes) found at approximate offset 567000 bytes. Corrupted Ogg.
WARNING: Hole in data (658 bytes) found at approximate offset 567000 bytes. Corrupted Ogg.
WARNING: Hole in data (532 bytes) found at approximate offset 567000 bytes. Corrupted Ogg.
WARNING: Hole in data (740 bytes) found at approximate offset 567000 bytes. Corrupted Ogg.
WARNING: Hole in data (113 bytes) found at approximate offset 567000 bytes. Corrupted Ogg.
WARNING: Hole in data (94 bytes) found at approximate offset 567000 bytes. Corrupted Ogg.
WARNING: Hole in data (100 bytes) found at approximate offset 567000 bytes. Corrupted Ogg.
WARNING: Hole in data (122 bytes) found at approximate offset 567000 bytes. Corrupted Ogg.
WARNING: Hole in data (360 bytes) found at approximate offset 567000 bytes. Corrupted Ogg.
WARNING: Hole in data (246 bytes) found at approximate offset 567000 bytes. Corrupted Ogg.
WARNING: Hole in data (483 bytes) found at approximate offset 567000 bytes. Corrupted Ogg.
WARNING: Hole in data (108 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (217 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (16 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (258 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (17 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (134 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (199 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (22 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (944 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (185 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (432 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (68 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (73 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (268 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (318 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (286 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (597 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (86 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (272 bytes) found at approximate offset 571500 bytes. Corrupted Ogg.
WARNING: Hole in data (90 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (369 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (41 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (258 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (103 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (371 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (151 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (206 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (43 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (44 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (98 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (97 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (472 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (101 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (276 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (198 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (70 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (17 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (35 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (370 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (152 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: Hole in data (105 bytes) found at approximate offset 576000 bytes. Corrupted Ogg.
WARNING: sequence number gap in stream 1. Got page 3 when expecting page 10. Indicates missing data.
WARNING: discontinuity in stream (1)
Opus stream 1:
Pre-skip: 312
Playback gain: 0 dB
Channels: 2
Original sample rate: 48000 Hz
Packet duration: 20.0ms (max), 20.0ms (avg), 20.0ms (min)
Page duration: 1000.0ms (max), 999.4ms (avg), 840.0ms (min)
Total data length: 4307109 bytes (overhead: 13.7%)
Playback length: 4m:02.853s
Average bitrate: 141.9 kbit/s, w/o overhead: 122.5 kbit/s
Logical stream 1 ended
i can also provide a reproduction program with the files if needed
ETA: opusinfo when the picture is properly embedded (using kid3)
Processing file ".\test.opus"...
New logical stream (#1, serial: 0b03ae00): type opus
Encoded with Lavf59.16.100
User comments section follows...
ALBUM=Sword Art Online
ARTIST=LiSA
ENCODER=Lavf59.16.100
LANGUAGE=eng
TITLE=Crossing Field
METADATA_BLOCK_PICTURE=3|image/png||1280x720x24|<416239 bytes of image data>
Opus stream 1:
Pre-skip: 312
Playback gain: 0 dB
Channels: 2
Original sample rate: 48000 Hz
Packet duration: 20.0ms (max), 20.0ms (avg), 20.0ms (min)
Page duration: 1000.0ms (max), 999.3ms (avg), 840.0ms (min)
Total data length: 4326350 bytes (overhead: 13.6%)
Playback length: 4m:03.833s
Average bitrate: 141.9 kbit/s, w/o overhead: 122.6 kbit/s
Logical stream 1 ended
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working