IPB

Welcome Guest ( Log In | Register )

Converting to Opus: 44.1 kHz resampled to 48 kHz
gurkburk
post Sep 17 2012, 18:40
Post #1





Group: Members
Posts: 1
Joined: 17-September 12
Member No.: 103219



So i have a bunch of regular 44100 flac files that i'de like to convert to OPUS file so i have something to listen to when i run, that's not very hard to setup following this guide.
http://www.saunalahti.fi/~cse/Opus/

What does concern me is that opusenc.exe seems to default to a samplingrate of 48000 when you feed it a raw stream (the '-' option as seen in the guide seems to do that) it's easy to see that the .opus files do indeed become converted/upsampled to 48000hz using this method.
So my question is, should i override this behavior by adding --raw-rate 44100 to the encoder?
Does it matter at all that the files get upsampled? Could it introduce noise or other unwanted side effects?

Thanks smile.gif

(yes i know that there aren't many android players yet avail for playback of opus, but the question still remains) smile.gif
Also i think this post belongs to this forums, at least it seemed like it was a good fit, but if i'm wrong please move it :\


This post has been edited by gurkburk: Sep 17 2012, 18:41
Go to the top of the page
+Quote Post
 
Start new topic
Replies
Dynamic
post Sep 19 2012, 01:15
Post #2





Group: Members
Posts: 815
Joined: 17-September 06
Member No.: 35307



To the OP's question, the resampler in Opus is very good and will be transparent and time-aligned by the time it's decoded (its delay is specified by the encoder as part of the pre-skip delay and stripped out by the decoder), so you need not worry. In a lossless encoder, perceptual transparency is all that matters.

Also regarding gaplessness, all CD-sourced material is an integer number of CD frames in length, each lasting 1/75th of a second. Fortunately this is an integer number of samples at both 48000 Hz (640 samples) and 44100 Hz (588 samples) so the accurate length can be precisely specified at either sampling rate, so it works in Opus regardless. cool.gif

An important addition to gapless playback for some sources is glitchless playback. Inherently, image+CUE files are glitchless but it seems nearly everyone desires track-per-file, few players support CUEsheets and many mainstream rippers are both insecure and don't support image+CUE.

Glitchless means that there should be no discontinuities in important aspects of the audio that could be perceived as a sound not present in the original music. Typically there might be level discontinuities that result in a broad band pop or click, or there might be slope discontinuities for example, with similar effect.

Glitchlessness appears, from posts above, to be acceptable in Ogg Vorbis with a suitably gapless player. It's also no problem in MP3s encoded as an image plus CUE then split into tracks with pcutmp3 (which uses the LAME accurate length and offset to create sample-accurate cuts and uses MP3 frames each side of the cut point in both halves of the split to maintain continuity, but only works with a player that supports LAME's gapless fix of course)

Opus uses asymptotically convergent prediction and specifies that a pre-skip is included in the header, which is non-audio that must be decoded silently before the decoder produces any sound in order to sufficiently converge the predictors. This should be at least 80ms, and ideally a bit longer to eliminate glitches in the worst cases. In the case of individual tracks it's likely that an encoder will use silence, or potentially even try something 'clever' like the start of the track played backwards to train the predictors before the audio begins. As the header includes the pre-skip offset before audio should commence, it's entirely possible to feed the encoder with enough of the tail end of the previous track, to make it effectively glitchless.

I'd expect there's a bit of inertia to overcome to rewrite ripping software to actually provide the prior-track samples and offset to the start of desired track to the encoder in some way.

Perhaps the easiest way to implement glitchless Opus ripping is for the encoder to support Image+CUE input but to be told to output in file-per-track mode, whereby it can automatically pick the right amount of pre-roll and automatically include data from the end of the previous track. People who care about glitchless, gapless playback would be happy to use a ripper in Image+CUE mode, passing that to the Opus encoder. Otherwise or additionally, it will be necessary to implement a method to pass prior track audio samples plus the offset to the start of audio, or to specify a switch that requires a fixed amount of additional audio (e.g. 15 CD frames = 15/75s = 0.2 s) offset which the encoder will use to train the predictors in the decoder to match very closely what they would have been if the two tracks had been encoded as a single piece of audio.

About 0.2 s of unheard audio in a typical 180 second track will not appreciably increase the effective bitrate over a collection of audio tracks.
Go to the top of the page
+Quote Post
NullC
post Sep 19 2012, 05:50
Post #3





Group: Developer
Posts: 200
Joined: 8-July 03
Member No.: 7653



QUOTE (Dynamic @ Sep 18 2012, 17:15) *
Also regarding gaplessness, all CD-sourced material is an integer number of CD frames in length, each lasting 1/75th of a second. Fortunately this is an integer number of samples at both 48000 Hz (640 samples) and 44100 Hz (588 samples) so the accurate length can be precisely specified at either sampling rate, so it works in Opus regardless. cool.gif
Gah. Opus gives sample accurate lengths for all sample rates <=48000. The (cool indeed) convenience of CD frames lengths isn't needed.

QUOTE
Glitchless means that there should be no discontinuities in important aspects of the audio that could be perceived as a sound not present in the original music. Typically there might be level discontinuities that result in a broad band pop or click, or there might be slope discontinuities for example, with similar effect.
Opusenc should achieve that already on inputs that are themselves glitchless, so long as the bitrate is high enough for the first and last frames that the distortion from lossyness doesn't break it.

QUOTE
Glitchlessness appears, from posts above, to be acceptable in Ogg Vorbis with a suitably gapless player.

And opus is in the same boat as Vorbis WRT this.

QUOTE
Opus uses asymptotically convergent prediction and specifies that a pre-skip is included in the header, which is non-audio that must be decoded silently before the decoder produces any sound in order to sufficiently converge the predictors. This should be at least 80ms, and ideally a bit longer to eliminate glitches in the worst cases. In the case of individual tracks it's likely that an encoder will use silence, or potentially even try something 'clever' like the start of the track played backwards to train the predictors before the audio begins.
No, a newly initialized encoder and decoder are instantly converged by definition. The 80ms advice applies to seeking. The preskip exists for three main reasons: To allow that convergence in streams that have been captured out of a longer running stream (analogous to seeking), to allow sample accurate trimming of existing encodes (same as the last reason, but different use case), and to hide the non-constant encoder+decoder latency (the decoder is constant, encoder depends on how its setup) to give sample accurate lengths.

QUOTE
I'd expect there's a bit of inertia to overcome to rewrite ripping software to actually provide the prior-track samples and offset to the start of desired track to the encoder in some way.

The original data may help improve the quality of the first and last frame. But I've not yet found an example where the existing LPC extrapolation (what vorbis does) for 'margin' filling is inadequate. Right now opusenc only LPC extrapolates the end, not the beginning, and it really surprises me that this is enough but so far it has been.

This post has been edited by NullC: Sep 19 2012, 05:52
Go to the top of the page
+Quote Post

Posts in this topic
- gurkburk   Converting to Opus: 44.1 kHz resampled to 48 kHz   Sep 17 2012, 18:40
- - [JAZ]   Opus does not natively support 44Khz. The idea is ...   Sep 17 2012, 19:03
- - LithosZA   QUOTE So my question is, should i override this be...   Sep 17 2012, 19:07
- - Kohlrabi   QUOTE (gurkburk @ Sep 17 2012, 19:40) tha...   Sep 17 2012, 19:08
- - lvqcl   QUOTE (gurkburk @ Sep 17 2012, 21:40) whe...   Sep 17 2012, 19:14
- - benski   how does the internal resampling effect gapless pl...   Sep 17 2012, 19:17
|- - Kohlrabi   QUOTE (benski @ Sep 17 2012, 20:17) how d...   Sep 17 2012, 19:28
|- - benski   QUOTE (Kohlrabi @ Sep 17 2012, 14:28) QUO...   Sep 17 2012, 20:22
|- - Brand   QUOTE (Kohlrabi @ Sep 17 2012, 20:28) Opu...   Sep 17 2012, 20:23
- - Kohlrabi   Apparently I might be wrong, it was deeply rooted ...   Sep 17 2012, 20:26
- - eahm   QUOTE (gurkburk @ Sep 17 2012, 10:40) So ...   Sep 17 2012, 21:12
- - yourlord   I believe I read in another thread that opus can...   Sep 17 2012, 21:27
- - Dynamic   To the OP's question, the resampler in Opus is...   Sep 19 2012, 01:15
|- - NullC   QUOTE (Dynamic @ Sep 18 2012, 17:15) Also...   Sep 19 2012, 05:50
|- - pdq   QUOTE (Dynamic @ Sep 18 2012, 20:15) In a...   Sep 19 2012, 15:26
- - Dynamic   Thanks again for the corrections, NullC. You know ...   Sep 19 2012, 09:00
|- - Brand   QUOTE (Dynamic @ Sep 19 2012, 10:00) I gu...   Sep 19 2012, 09:55
|- - NullC   QUOTE (Brand @ Sep 19 2012, 01:55) EDIT2:...   Sep 19 2012, 14:19
- - Brand   I can reproduce with opusenc+opusdec. In fact opus...   Sep 19 2012, 15:25
- - Case   I'm usually very sensitive to glitches, but I ...   Sep 19 2012, 16:10
- - punkrockdude   Hehe. Gurkburk, du kan inte vara något annat än sv...   Oct 8 2012, 13:25
- - C.R.Helmrich   I have a similar question as the OP. In my case th...   Jan 20 2013, 12:45
|- - nu774   I'm not an "expert" but from what I ...   Jan 20 2013, 16:35
|- - nu774   It might have not been enough explanation... ...   Jan 20 2013, 16:47
|- - C.R.Helmrich   Yes, I expected Opus to resample to 48 kHz interna...   Jan 20 2013, 22:35
|- - nu774   QUOTE (C.R.Helmrich @ Jan 21 2013, 06:35)...   Jan 21 2013, 02:19
|- - jmvalin   QUOTE (C.R.Helmrich @ Jan 20 2013, 16:35)...   Jan 21 2013, 03:55
|- - C.R.Helmrich   Thanks, guys. I'll wait for the 1.1 beta then....   Jan 21 2013, 18:40
- - IgorC   Chris, feel free to submit problematic samples for...   Jan 21 2013, 18:44
- - mzso   Why 48kHz? If the lowpass frequency is 20kHz why ...   Mar 14 2013, 15:55
|- - lvqcl   QUOTE (mzso @ Mar 14 2013, 18:55) why not...   Mar 14 2013, 16:05
- - wswartzendruber   Doesn't the CELT layer work strictly at 48 kHz...   Mar 14 2013, 21:58
- - Dynamic   I think the CELT layer in Opus (possibly not in th...   Mar 15 2013, 18:28
|- - jmvalin   QUOTE (Dynamic @ Mar 15 2013, 13:28) I th...   Mar 15 2013, 18:51
- - Brazil2   Something is still not clear to me: is the interna...   May 29 2013, 08:59
- - saratoga   No, a resampler changes the sampling rate. If the ...   May 29 2013, 14:42
- - Brazil2   That's the theory, but does it *really* behave...   May 29 2013, 16:30
|- - saratoga   QUOTE (Brazil2 @ May 29 2013, 11:30) That...   May 29 2013, 16:53
|- - greynol   QUOTE (Brazil2 @ May 29 2013, 08:30) That...   May 29 2013, 18:01
- - NullC   Thats the problem with these totally opaque closed...   May 29 2013, 19:44
|- - Banned   QUOTE (NullC @ May 29 2013, 20:44) Thats ...   Jun 2 2013, 10:29
|- - skamp   QUOTE (NullC @ May 29 2013, 20:44) Thats ...   Jun 2 2013, 10:54
- - db1989   Yes, I think we can safely deduce that sarcasm was...   Jun 2 2013, 10:58
- - Mardel   For listening test (wav file). If I resample to 44...   Sep 14 2013, 13:08
|- - bandpass   QUOTE (Mardel @ Sep 14 2013, 13:08) For l...   Sep 14 2013, 14:47
- - db1989   You tell us. You even mentioned listening tests. Q...   Sep 14 2013, 14:03
|- - Mardel   QUOTE (db1989 @ Sep 14 2013, 15:03) You t...   Sep 14 2013, 14:13
- - db1989   An assumed condition of double-blind tests is that...   Sep 14 2013, 14:19
- - Mardel   Ok. Thx!   Sep 14 2013, 18:51
- - IgorC   Here is my experience with Opus and handling of a ...   Sep 15 2013, 19:19


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 17th September 2014 - 07:43