Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Opus encoder - how to discard pictures with opus-tools 0.1.8? (Read 3460 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Opus encoder - how to discard pictures with opus-tools 0.1.8?

With AOSP ROMs of Android 5 just around the corner, I've decided that I'll use native support as the motivation to go all-in with Opus and use it for music as well as speech audio.

After testing, I found that I could reach my desired quality at a target bitrate ~16-20kbps less than my current Vorbis setting so I went ahead and transcoded my FLAC library.  Eventually, I was pleased to find that, at my chosen settings, switching to Opus saves over 2GB of storage space on my microSD card.

I say 'eventually' because I was forced to spent a bit of time 'laundering' the Opus output files using a tagging program.  See, each file in my FLAC library has high resolution cover art embedded.  During encoding, this was copied to the output files by default since I used the command-line in Ubuntu 14.04 to encode (opus-tools 0.1.8 is the version in the repositories). 

After extracting the cover art from the Opus files with a tagger, I cut 5GB off the size of my Opus library by reducing the size and quality of each cover image before re-embedding them (thankfully, the developer has fixed the Opus cover art bug in kid3-cli so I was able to automate the process).

Whilst it's not a huge deal (I can easily amend scripts to perform the re-sizing after each encode) my question is this: is there any way of preventing the transfer of cover art during encoding using opus-tools 0.1.8?

I am aware that 0.1.9 brought the –discard-pictures switch but prior to that, how can cover art be discarded when using the command-line encoder?  I tested the –discard-comments option but that unhelpfully discards everything except the cover art.  Does anybody know?

Opus encoder - how to discard pictures with opus-tools 0.1.8?

Reply #1
I think you've answered your own question.  v0.1.9 brought the new switch because v0.1.8 didn't do it.  You might try an older version, because they didn't support embedded artwork well, or in some cases at all.

Opus encoder - how to discard pictures with opus-tools 0.1.8?

Reply #2
I'm surprised that it's impossible to encode with 0.1.8 without transferring cover art but it's not a huge deal.

A missing dependency issue means I'm unable to build 0.1.9 from source so I'll just have to continue using my work-around until it's updated in the software repositories.

Thanks for your response.

Opus encoder - how to discard pictures with opus-tools 0.1.8?

Reply #3
I actually just transcoded my library to opus as well in anticipation of native support. I am fine with Vorbis at 96kbps so I figured I'd try opus at 80kbps. The results were really impressive, but I kept finding artifacts in spots here and there which bordered on annoying. Opus at 80kbps was far more appealing to me than Vorbis at 80kbps, but I don't think it will allow me to pull the trigger and shrink my storage usage. I'll just be content with the extra safety margin opus affords me over Vorbis at the same (96kbps) bitrate.

Opus encoder - how to discard pictures with opus-tools 0.1.8?

Reply #4
I actually just transcoded my library to opus as well in anticipation of native support. I am fine with Vorbis at 96kbps so I figured I'd try opus at 80kbps. The results were really impressive, but I kept finding artifacts in spots here and there which bordered on annoying. Opus at 80kbps was far more appealing to me than Vorbis at 80kbps, but I don't think it will allow me to pull the trigger and shrink my storage usage. I'll just be content with the extra safety margin opus affords me over Vorbis at the same (96kbps) bitrate.


I hear you.  I guess the moral of the story is, once again, testing is where it's at.

I went slightly higher on bitrate but I'm thankful I decided to do a little testing before encoding.  At one point, I considered just going for an identical bitrate to my previous Vorbis setting.  I figured that it's unlikely my music would sound worse and on the list of things I actively enjoy doing, performing meticulous ABX testing ranks slightly below pushing a whirring power drill into my eye.

Yet while that little devil on my left shoulder was whispering 'don't bother testing', there was a little angel on my other shoulder convincing me to approach things a little more rationally.  It was almost as if the smug little cherub was saying 'I told you so' after ABX testing found that I could save ~16kbps on my previous Vorbis setting.

After testing, I also wrote a simple script to take a look at file sizes.  I took a look at my 'Popular_Songs' playlist and copied 2 songs from each genre.  I ended up with 30 songs which – although way too small a sample to be representative of my entire music library – I hoped would give me some idea of file size differences.

The script took the FLAC files, stripped all metadata, decoded to WAV, transcoded to the latest Opus, Vorbis and NeroAAC (purely for reference, and seemed to offer more encoding granularity than other AAC encoders on my Ubuntu set-up) at 16kbps intervals, and output file sizes (in MB) to a CSV file.  If anyone fancies a glimpse at the output, I've tidied it up and pasted it into online Excel here: http://1drv.ms/1tBpOOr

At my tested Opus bitrate, I found that I could compare the Vorbis value with the Opus value in the preceding column.  Since I don't do subsets (I'm one of those got-to-have-all-my-music-available-at-all-times people), I was pleased to find that storage savings should postpone my need for a 128GB microSD for a few years at the least.

Based on my spreadsheet, I found that Opus at a directly equivalent bitrate resulted in an ever-so-slightly larger file size footprint, although obviously file size is dependent on all sorts of variables.  What did you find for your library?

Opus encoder - how to discard pictures with opus-tools 0.1.8?

Reply #5
Quote
I found that Opus at a directly equivalent bitrate resulted in an ever-so-slightly larger file size footprint

?

The bitrate given on the command line to different encoders should not be considered to be the resulting file bitrate, and certainly you can't compare one with another that way.  Opus, to take one example, has a variable bitrate setting that is prone to aiming for that bitrate and then grabbing more when it finds a "tricky bit".  The result is more often than not a slightly higher bitrate than you asked for, which could be what you are seeing as a large file size.  Since the "bitrate" of these lossy files is just the file size divided by the length of the audio, the only thing you are comparing at identical bitrates is the container overhead.  Since Vorbis and Opus both use Ogg there really isn't much to compare there.

At first I thought that number between about 2 and 5 was an ABX rating, but I'm guessing it is actually the file size?

Opus encoder - how to discard pictures with opus-tools 0.1.8?

Reply #6
Quote
I found that Opus at a directly equivalent bitrate resulted in an ever-so-slightly larger file size footprint

?

The bitrate given on the command line to different encoders should not be considered to be the resulting file bitrate, and certainly you can't compare one with another that way.  Opus, to take one example, has a variable bitrate setting that is prone to aiming for that bitrate and then grabbing more when it finds a "tricky bit".  The result is more often than not a slightly higher bitrate than you asked for, which could be what you are seeing as a large file size.  Since the "bitrate" of these lossy files is just the file size divided by the length of the audio, the only thing you are comparing at identical bitrates is the container overhead.  Since Vorbis and Opus both use Ogg there really isn't much to compare there.

At first I thought that number between about 2 and 5 was an ABX rating, but I'm guessing it is actually the file size?


You're right, my use of the term 'bitrate' and the numbers in the table refer to the numerical setting passed to the Opus encoder (the '--bitrate' switch).  I should have used the term 'target/encoding bitrate' to be a little more precise.

The table shows a comparison of output file sizes of different encoders at a given target bitrate.  If I were comparing resulting file bitrates, then the results of Vorbis/Opus would be virtually identical.

Yep, the numbers are indeed file sizes (in MB).  They don't reveal a great deal but did provide an indication of storage space savings prior to full library encode.