Thanks.
I have a 44100 pcm wav file
$ mediainfo 01\ -\ Introduction.wav
General
Complete name : 01 - Introduction.wav
Format : Wave
File size : 16.6 MiB
Duration : 1mn 38s
Overall bit rate mode : Constant
Overall bit rate : 1 411 Kbps
Audio
Format : PCM
Format settings, Endianness : Little
Format settings, Sign : Signed
Codec ID : 1
Duration : 1mn 38s
Bit rate mode : Constant
Bit rate : 1 411.2 Kbps
Channel(s) : 2 channels
Sampling rate : 44.1 KHz
Bit depth : 16 bits
Stream size : 16.6 MiB (100%)
I encode it to opus:
$ opusenc --bitrate 48 01\ -\ Introduction.wav 01\ -\ Introduction.opus
$ opusinfo 01\ -\ Introduction.opus
Processing file "01 - Introduction.opus"...
New logical stream (#1, serial: 427536f0): type opus
Encoded with libopus 1.1-alpha
User comments section follows...
ENCODER=opusenc from opus-tools 0.1.6
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), 998.0ms (avg), 800.0ms (min)
Total data length: 591007 bytes (overhead: 1.31%)
Playback length: 1m:38.773s
Average bitrate: 47.87 kb/s, w/o overhead: 47.24 kb/s
Logical stream 1 ended
I play it:
$ opusdec 01\ -\ Introduction.opus
Decoding to 48000 Hz (2 channels)
Encoded with libopus 1.1-alpha
ENCODER=opusenc from opus-tools 0.1.6
[-] 00:00:07
or
$ opusdec 01\ -\ Introduction.opus --force-wav -|mplayer -
Decoding to 44100 Hz (2 channels)
Encoded with libopus 1.1-alpha
ENCODER=opusenc from opus-tools 0.1.6
MPlayer2 UNKNOWN (C) 2000-2012 MPlayer Team
Playing -.
Reading from stdin...
Detected file format: WAV / WAVE (Waveform Audio) (libavformat)
[|] 00:00:05[wav @ 0x8771620]max_analyze_duration reached
[lavf] stream 0: audio (pcm_s16le), -aid 0
Load subtitles in .
Selected audio codec: Uncompressed PCM [pcm]
AUDIO: 44100 Hz, 2 ch, s16le, 1411.2 kbit/100.00% (ratio: 176400->176400)
AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)
[Mixer] No hardware mixing, inserting volume filter.
Video: no video
Starting playback...
^C 1.7 (01.7) of 12173.9 ( 3:22:53.9) 0.1%
I decode the opus file back to wav:
$ opusdec 01\ -\ Introduction.opus 01\ -\ Introduction_opus.wav
Decoding to 44100 Hz (2 channels)
Encoded with libopus 1.1-alpha
ENCODER=opusenc from opus-tools 0.1.6
Decoding complete.
$ mediainfo 01\ -\ Introduction_opus.wav
General
Complete name : 01 - Introduction_opus.wav
Format : Wave
File size : 16.6 MiB
Duration : 1mn 38s
Overall bit rate mode : Constant
Overall bit rate : 1 411 Kbps
Audio
Format : PCM
Format settings, Endianness : Little
Format settings, Sign : Signed
Codec ID : 1
Duration : 1mn 38s
Bit rate mode : Constant
Bit rate : 1 411.2 Kbps
Channel(s) : 2 channels
Sampling rate : 44.1 KHz
Bit depth : 16 bits
Stream size : 16.6 MiB (100%)
So according to the opusdec printed output and the file written to disk, opusdec does sample rate convert to 44100 in some circumstances: "Decoding to 44100 Hz (2 channels)" and decodes without conversion in others "Decoding to 48000 Hz (2 channels)". It looks to me that when the original sample rate is known to be 44100 then either specifying --force-wav to stdout or writing to disk causes opusdec to decode to 44100 (whereas if I instead do 'ffmpeg -i <opus_file> -acodec pcm_s16le <wav_file>' I do indeed get a 48000 Hz wav).
For the sake of battery life I'll stick with 'lame --resample 22.05 -m m --abr 64' for audiobooks and similar mono files for the moment but it would be great if opus were a really practical option.
If opus' own sample rate converter is superior to Rockbox's then would it be possible for Rockbox to take advantage of that in future versions, decoding to 44100 and avoiding any possible sound quality and CPU loading issues?