fmang / opustags

Ogg Opus tags editor
BSD 3-Clause "New" or "Revised" License
75 stars 10 forks source link

Output is not fully written #18

Closed bruceg closed 5 years ago

bruceg commented 7 years ago

When editing tags, the output file is not completely written. This happens every time the program is run. The output file size is consistent between runs on the same input, but has different length on other inputs.

> build/opustags --output output.opus --add title=Title sample.opus 
> ls -l *.opus
-rw-rw-r-- 1 bruce users    789908 Sep 22 17:53 output.opus
-rw-rw-r-- 1 bruce users   2857825 Sep 22 17:47 sample.opus

The resulting output file, when played through ffmpeg (via mpv), reports missing granules as well:

Playing: output.opus
[ffmpeg/demuxer] ogg: Page at 160 is missing granule
[ffmpeg/demuxer] ogg: Page at 160 is missing granule
[ffmpeg/demuxer] ogg: Unsupported huge granule pos -1
[ffmpeg/demuxer] ogg: Page at 160 is missing granule
[ffmpeg/demuxer] ogg: Unsupported huge granule pos -1
 (+) Audio --aid=1 --alang=eng 'Title' (opus 2ch 48000Hz)
File tags:
 Title: Title
[ffmpeg/demuxer] ogg: Page at 160 is missing granule
[ffmpeg/demuxer] ogg: Unsupported huge granule pos -1
[ffmpeg/demuxer] ogg: Page at 160 is missing granule
[ffmpeg/demuxer] ogg: Unsupported huge granule pos -1
.....
[ffmpeg/demuxer] ogg: Page at 201024 is missing granule
[ffmpeg/demuxer] ogg: Unsupported huge granule pos -1
[ffmpeg/demuxer] ogg: Page at 201024 is missing granule
[ffmpeg/demuxer] ogg: Unsupported huge granule pos -1

The file plays, but is truncated.

opustags was built with GCC 5.4.0 and linked against libogg-1.3.2

fmang commented 7 years ago

The missing granule suggests a bigger issue than just file truncation. opustags uses libogg to naively copy pages from stream to stream, without editing anything but the page containing the tags, so there's something wrong here.

Anyway, this project is getting old and was made because nothing else supported Opus at the time. Could you look around and see if the popular tag editors fit your needs? If you find something, please let me know, I'll bury opustags and add a notice suggesting the other editor.

bruceg commented 6 years ago

That's the problem. I have not found another command-line opus tag modifier. The opusenc command can of course add tags when it encodes the file, but that doesn't help if I already have an encoded file.

fmang commented 6 years ago

Opus is not well known yet, so it tends to be skipped in supported formats lists, even when the backend does support it.

Have you tried Kid3? The K is scary if you don't use KDE, but it looks like it's got a Qt version without the KDE dependencies, and also a command-line interface tool on a dedicated package. Opus is explicitly supported.

You also have taffy, a light CLI wrapper written in Ruby, based on TagLib like Kid3. It looks easier to use than Kid3's CLI but is probably not as powerful.

Alternatively, Mutagen provides a simple Python API. I should be able to quickly rewrite opustags as a wrapper around this library if Kid3 won't cooperate.

fmang commented 5 years ago

I'm closing this issue, it's getting old. opustags should work with most files, so yours might have something special. If you run into the problem again, I can look further into this issue, but I'm going to need your opus file. Last time I thought I'd bury opustags forever, but now I'm considering it's worth fixing.