Ive set up my MPD to start encoding streamed output using opus codec. It works quite well, I can connect to it with Firefox and hear the audio.
I wanted to set it to work on command line and thus tried:
Code:
wget http://$MPD_HOST/ -O - | opusdec --force-wav - - | aplay
For some reason though, opusdec does not generate any output when working on streams. For example, if I save some of the stream to a file and try decoding it, the result is empty:
Code:
$ wget http://$MPD_HOST/ -O test.opus
--2015-03-19 14:28:56-- http:///
Connecting to 127.0.0.1:6090... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [audio/ogg]
Saving to: test.opus
[ <=> ] 319,433 12.3KB/s ^C
$ opusinfo test.opus
Processing file "test.opus"...
New logical stream (#1, serial: 6b7012fd): type opus
Encoded with libopus 1.1
WARNING: sequence number gap in stream 1. Got page 1506 when expecting page 2. Indicates missing data. (normal for live streams)
WARNING: discontinuity in stream (1)
WARNING: EOS not set on stream 1 (normal for live streams)
Opus stream 1:
Pre-skip: 312
Playback gain: 0 dB
Channels: 2
Original sample rate: 48000Hz
Packet duration: 20.0ms (max), 20.0ms (avg), 20.0ms (min)
Page duration: 360.0ms (max), 246.6ms (avg), 20.0ms (min)
Total data length: 319433 bytes (overhead: 1.35)
Playback length: 0m:25.393s
Average bitrate: 100.6 kb/s, w/o overhead: 99.28 kb/s
$ opusdec test.opus test.pcm
Decoding to 48000 Hz (2 channels)
Encoded with libopus 1.1
Decoding complete.
$ ls -l
total 312
-rw------- 1 mpn eng 319433 Mar 19 14:29 test.opus
-rw------- 1 mpn eng 0 Mar 19 14:29 test.pcm
Things work great with stand alone files:
Code:
$ opusinfo ehren-paper_lights-96.opus
Processing file "ehren-paper_lights-96.opus"...
New logical stream (#1, serial: 35f25b46): type opus
Encoded with libopus 1.0.1-rc3
User comments section follows...
ENCODER=opusenc from opus-tools 0.1.5
artist=Ehren Starks
title=Paper Lights
album=Lines Build Walls
date=2005-09-05
copyright=Copyright 2005 Ehren Starks
license=http://creativecommons.org/licenses/by-nc-sa/1.0/
organization=magnatune.com
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), 996.2ms (avg), 120.0ms (min)
Total data length: 2629170 bytes (overhead: 0.695)
Playback length: 3m:48.106s
Average bitrate: 92.21 kb/s, w/o overhead: 91.57 kb/s
Logical stream 1 ended
$ opusdec - - <ehren-paper_lights-96.opus >ehren-paper_lights-96.pcm
Decoding to 44100 Hz (2 channels)
Encoded with libopus 1.0.1-rc3
ENCODER=opusenc from opus-tools 0.1.5
artist=Ehren Starks
title=Paper Lights
album=Lines Build Walls
date=2005-09-05
copyright=Copyright 2005 Ehren Starks
license=http://creativecommons.org/licenses/by-nc-sa/1.0/
organization=magnatune.com
Decoding complete.
$ ls -l ehren-paper_lights-96.*
-rw------- 1 mpn eng 2629170 Feb 27 2013 ehren-paper_lights-96.opus
-rw------- 1 mpn eng 40238016 Mar 19 14:31 ehren-paper_lights-96.pcm
What makes things infinitely stranger is that it used to work just fine, but at one point Ive stopped the wget-opusdec-aplay pipe and when I started it again, it opusdec refused to cooperate.
Does anyone have any ideas? How to debug it? Or pointers to some command-line stream players supporting opus codec?
Code:
$ opusdec -V
opusdec opus-tools 0.1.8 (using libopus 1.1)
Copyright (C) 2008-2013 Xiph.Org Foundation
$ opusinfo -V
opusinfo from opus-tools 0.1.8