Page 1 of 1

Searching for specific stream type

Posted: April 3rd, 2021, 11:50 am
by klassikmann
I'm using streams of the "ARD-Hörfunktransponder" provided by a SAT-receiver as MPEG2 transport streams (*.ts). Most of the streams contain one audio elementary stream of type MP2 only, but some of them - the classical music stations as BR-Klassik - contain AC3 (2CH, sometimes 6CH) besides MP2 additionally. For both types of streams mpd plus the activated ffmpeg plugin detects the MP2 stream only and plays it correctly, see verbose log:

Code: Select all

Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: max_analyze_duration 7000000 reached at 7008000 microseconds st:1
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: stream 0: start_time: 60787.7 duration: NOPTS
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: stream 1: start_time: 60787.7 duration: NOPTS
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: stream 2: start_time: NOPTS duration: NOPTS
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: stream 3: start_time: NOPTS duration: NOPTS
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: format: start_time: 60787.7 duration: NOPTS (estimate from bit rate) bitrate=768 kb/s
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: Could not find codec parameters for stream 2 (Unknown: none ([5][0][0][0] / 0x0005)): unknown codec
Apr 03 12:23:30 rAudio taskset[2393]: Consider increasing the value for the 'analyzeduration' and 'probesize' options
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: Could not find codec parameters for stream 3 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
Apr 03 12:23:30 rAudio taskset[2393]: Consider increasing the value for the 'analyzeduration' and 'probesize' options
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: After avformat_find_stream_info() pos: 751060 bytes read:752464 seeks:0 frames:515
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg: codec 'mp2'
Apr 03 12:23:30 rAudio taskset[2393]: decoder: audio_format=48000:16:2, seekable=false
Apr 03 12:23:30 rAudio taskset[2393]: client: [2] process command "idle"
Apr 03 12:23:30 rAudio taskset[2393]: client: [2] command returned 1
Apr 03 12:23:30 rAudio taskset[2393]: client: [32] opened from 127.0.0.1:39584
Apr 03 12:23:30 rAudio taskset[2393]: client: [32] process command list
Apr 03 12:23:30 rAudio taskset[2393]: client: process command "status"
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: pid=84 pes_code=0x1bd
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: PAT:
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: pid=83 pes_code=0x1c0
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: pid=84 pes_code=0x1bd
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: PMT: len 79
Apr 03 12:23:30 rAudio taskset[2393]: alsa_output: opened hw:0,0 type=HW
Apr 03 12:23:30 rAudio taskset[2393]: alsa_output: buffer: size=128..131072 time=2666..2730667
Apr 03 12:23:30 rAudio taskset[2393]: alsa_output: period: size=64..65536 time=1333..1365334
Apr 03 12:23:30 rAudio taskset[2393]: alsa_output: default period_time = buffer_time/4 = 500000/4 = 125000
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: pid=84 pes_code=0x1bd
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: pid=83 pes_code=0x1c0
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: pid=84 pes_code=0x1bd
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: PAT:
Apr 03 12:23:30 rAudio taskset[2393]: ffmpeg/mpegts: pid=84 pes_code=0x1bd
Apr 03 12:23:30 rAudio taskset[2393]: alsa_output: format=S16_LE (Signed 16 bit Little Endian)
Apr 03 12:23:30 rAudio taskset[2393]: alsa_output: buffer_size=24000 period_size=6000
Apr 03 12:23:30 rAudio taskset[2393]: output: opened "hifiberry-digi" (alsa) audio_format=48000:16:2
Question:
Do you see any possibility to configure mpd such a way, that first priority is to play the AC3 stream (which is of a much better quality mostly) and MP2 as a fallback?

Example of a TS containing both MP2 and AC3: https://www.magentacloud.de/lnk/9eqAoyCK

HW/SW-configuration:
RPi 3B + HifiBerry Digi+ Pro
Archlinux Kernel 5.10.25-4 aarch64
Application: rAudio-1 (https://github.com/rern/rAudio-1, spin-off of RuneAudio)
mpd: 0.22.6
fmpeg: 4.3.2

/etc/mpd.conf:

Code: Select all

bind_to_address        "0.0.0.0"
db_file                "/srv/http/data/mpd/mpd.db"
music_directory        "/mnt/MPD"
playlist_directory     "/var/lib/mpd/playlists"
replaygain             "off"
state_file             "/srv/http/data/mpd/mpdstate"
user                   "mpd"

input {
	plugin         "curl"
}

decoder {
	plugin         "ffmpeg"
	enabled        "yes"
}

resampler {
	plugin         "soxr"
	quality        "very high"
}

audio_output {
	name           "hifiberry-digi"
	device         "hw:0,0"
	type           "alsa"
	auto_resample  "no"
	auto_format    "no"
	mixer_type     "none"
}