After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 779649 - easytag 2.4.3 corrupts Opus files
easytag 2.4.3 corrupts Opus files
Status: RESOLVED DUPLICATE of bug 776110
Product: easytag
Classification: Other
Component: general
2.4.x
Other Linux
: Normal major
: 2.4
Assigned To: EasyTAG maintainer(s)
EasyTAG maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-03-06 12:19 UTC by Florian Berger
Modified: 2017-07-04 20:03 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Florian Berger 2017-03-06 12:19:20 UTC
When adding tags to Opus files, easytag 2.4.3 corrupts them in a ways that at least the GStreamer-based player Exaile will refuse to play them, and opusinfo will issue a warning.

Here is a before-after example:

Before: http://0x6c2.de/audio/bilderbuch-bungalow-opusenc.opus

$ opusinfo bilderbuch-bungalow-opusenc.opus 
Processing file "bilderbuch-bungalow-opusenc.opus"...

New logical stream (#1, serial: 725322b4): type opus
Encoded with libopus 1.1.3
User comments section follows...
	ENCODER=opusenc from opus-tools 0.1.9
	title=
	artist=
	album=
	genre=
	date=
	tracknumber=
	tracktotal=
	ENCODER_OPTIONS=--bitrate 256 --vbr
Opus stream 1:
	Pre-skip: 356
	Playback gain: 0 dB
	Channels: 2
	Original sample rate: 44100Hz
	Packet duration:   20.0ms (max),   20.0ms (avg),   20.0ms (min)
	Page duration:   1000.0ms (max),  997.0ms (avg),  320.0ms (min)
	Total data length: 7393928 bytes (overhead: 0.569%)
	Playback length: 3m:45.303s
	Average bitrate: 262.5 kb/s, w/o overhead: 261 kb/s
Logical stream 1 ended


After: http://0x6c2.de/audio/bilderbuch-bungalow-easytag.opus

$ opusinfo bilderbuch-bungalow-easytag.opus 
Processing file "bilderbuch-bungalow-easytag.opus"...

New logical stream (#1, serial: 725322b4): type opus
Encoded with libopus 1.1.3
User comments section follows...
	TITLE=Bungalow
	ARTIST=Bilderbuch
	ALBUM=Bungalow
	DATE=2017
	TRACKNUMBER=01
	TRACKTOTAL=01
WARNING: Invalid packet or misplaced header in stream 1
Negative or zero granulepos (0) on Opus stream outside of headers. This file was created by a buggy encoder
WARNING: Invalid packet or misplaced header in stream 1
Negative or zero granulepos (0) on Opus stream outside of headers. This file was created by a buggy encoder
Opus stream 1:
	Pre-skip: 356
	Playback gain: 0 dB
	Channels: 2
	Original sample rate: 44100Hz
	Packet duration:   20.0ms (max),   20.0ms (avg),   20.0ms (min)
	Page duration:    540.0ms (max),  135.2ms (avg),    0.0ms (min)
	Total data length: 7432964 bytes (overhead: 1.08%)
	Playback length: 3m:45.303s
	Average bitrate: 263.9 kb/s, w/o overhead: 261.1 kb/s
Logical stream 1 ended


Expected behaviour: After adding tags, the file should play just fine, and issue no warnings in opusinfo.

Actual behaviour: opusinfo complains "Invalid packet or misplaced header in stream 1. Negative or zero granulepos (0) on Opus stream outside of headers. This file was created by a buggy encoder". Player Exaile, using gst-plugins-opus, refuses to play the file, yielding:

ERROR: <gst.Message GstMessageError, gerror=(GError)NULL, debug=(string)"/var/tmp/portage/media-plugins/gst-plugins-opus-0.10.23-r1/work/gst-plugins-bad-0.10.23/ext/opus/gstopusdec.c\(434\):\ opus_dec_chain_parse_data\ \(\):\ /GstPlayBin2:player/GstURIDecodeBin:uridecodebin23/GstDecodeBin2:decodebin223/GstOpusDec:opusdec13";
Comment 1 David King 2017-03-06 14:50:27 UTC

*** This bug has been marked as a duplicate of bug 776110 ***
Comment 2 Florian Berger 2017-03-15 19:00:53 UTC
For the record and search engines, here is a shell script that will re-encode defunct Opus files, preserving the most prominent tags:

#!/bin/bash

if [ "$1" == "" ] ;
then
    echo 'Usage: opus2opus.sh FILE.opus [FILE.opus ...]';
else
    for i in "$@" ;
    do
        opusdec --force-wav "$i" - | \
        opusenc --bitrate 256 \
                --vbr \
                --title "`opusinfo \"$i\" | grep -i 'title=' | sed -e 's/^.*=//'`" \
                --artist "`opusinfo \"$i\" | grep -i 'artist=' | sed -e 's/^.*=//'`" \
                --comment album="`opusinfo \"$i\" | grep -i 'album=' | sed -e 's/^.*=//'`" \
                --comment date="`opusinfo \"$i\" | grep -i 'date=' | sed -e 's/^.*=//'`" \
                --comment tracknumber="`opusinfo \"$i\" | grep -i 'tracknumber=' | sed -e 's/^.*=//'`" \
                --comment tracktotal="`opusinfo \"$i\" | grep -i 'tracktotal=' | sed -e 's/^.*=//'`" \
                - \
                "${i%.opus}_reencode.opus" ;
        # To be 100% sure, check file.
        #
        echo 'Checking result ...' ;
        opusinfo "${i%.opus}_reencode.opus" | grep WARN ;
    done ;
fi ;
Comment 3 Tristan Miller 2017-07-04 20:03:32 UTC
(In reply to Florian Berger from comment #2)
> For the record and search engines, here is a shell script that will
> re-encode defunct Opus files, preserving the most prominent tags:

It looks like your script is lossy.  Is there no way of preserving the Opus stream without re-encoding it?