Streaming from the input

Moderator: flatmax

abonam
Posts: 20
Joined: Sat May 13, 2017 7:21 am

Re: Streaming from the input

Post by abonam » Tue May 23, 2017 4:13 am

Hello Matt,

I would like to try to re-compile ffmpeg/ffplay to exclude the video part, just to see if there are differences on the CPU load of the PI.
Right now with the ffmpeg I got from the distribution package, the CPU load is 30%.

Can you kindly re-post the sequence to compile both?
Thanks!!
Andrea

flatmax
Posts: 609
Joined: Sat Jul 23, 2016 11:39 pm

Re: Streaming from the input

Post by flatmax » Tue May 23, 2017 4:56 pm

I found that avconv has disabled support for avserver completely.

You will want to get the sources and compile ffmpeg to remove all video related stuff. So for example, assuming you want to build only the encoder for ffmpeg and ffserver, with only wav file encoding and muxing, then ...
First get the sources :

Code: Select all

apt-get source ffmpeg
Then configure :

Code: Select all

./configure \
       --disable-filters \
	--disable-postproc \
	--disable-swscale \
	--disable-everything \
	--disable-decoder=pcm_bluray,pcm_dvd \
	--disable-ffplay --disable-ffprobe \
	--disable-demuxers \
	--disable-decoders \
	--disable-avresample \
	--enable-encoder=pcm_* \
	--enable-decoder=pcm_* \
	--enable-libwavpack \
	--enable-encoder=wav \
	--enable-decoder=wav \
	--enable-muxer=wav \
	--enable-demuxer=wav \
	--enable-protocol=file \
	--enable-filter=aresample \
	--enable-indev=alsa \
	--enable-ffserver --enable-ffmpeg \
Then make and install :

Code: Select all

make

Code: Select all

make install
Now if you want to do this and end up with debian packages, then you will need to do the following :
Get the source and edit the file debian/rules. Carefully change the 'CONFIG' variable to keep what is necessary in compile flags and dir detail, but switch out for your required configure flags.
Once that is done, you will want to run this to build the .deb files in the ".." directory :

Code: Select all

dpkg-buildpackage -us -uc -b
Please update this thread once you have success with the steps you took !

Matt
Check out our audiophile quality crossovers : https://bit.ly/2kb1nzZ
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector

flatmax
Posts: 609
Joined: Sat Jul 23, 2016 11:39 pm

Re: Streaming from the input

Post by flatmax » Tue May 23, 2017 5:09 pm

Oh by the way, if you want most of the audio stuff built in, then here is what you should do ... current problem with this configuration is that it doesn't produce ffplay and ffmpeg only ffprobe and ffserver

Set your configure flags to disable mostly everything :

Code: Select all

	--disable-programs \
	--disable-avfilter \
	--disable-postproc \
	--disable-swresample \
	--disable-swscale \
	--disable-everything \
	--disable-decoder=pcm_bluray,pcm_dvd \
Then enable the following audio decoders, demuxers and parsers :

Code: Select all

	--enable-libspeex --enable-decoder=libspeex \
--enable-ffserver --enable-ffmpeg --enable-ffplay \
Audio decoders :

Code: Select all

	--enable-decoder=aac \
	--enable-decoder=aac_latm \
	--enable-decoder=ac3 \
	--enable-decoder=adpcm_* \
	--enable-decoder=alac \
	--enable-decoder=amrnb \
	--enable-decoder=amrwb \
	--enable-decoder=ape \
	--enable-decoder=atrac3 \
	--enable-decoder=flac \
	--enable-decoder=mp2 \
	--enable-decoder=mp3* \
	--enable-decoder=mpc7 \
	--enable-decoder=mpc8 \
	--enable-decoder=opus \
	--enable-decoder=pcm_* \
	--enable-decoder=vorbis \
	--enable-decoder=wavpack \
	--enable-decoder=wmav1 \
	--enable-decoder=wmav2 \
	--enable-decoder=wmalossless \
	--enable-decoder=wmapro \
	--enable-decoder=zlib \
demuxers :

Code: Select all

	--enable-demuxer=aac \
	--enable-demuxer=ac3 \
	--enable-demuxer=aiff \
	--enable-demuxer=amr \
	--enable-demuxer=ape \
	--enable-demuxer=avi \
	--enable-demuxer=flac \
	--enable-demuxer=ffm \
	--enable-demuxer=matroska \
	--enable-demuxer=mp3 \
	--enable-demuxer=mov \
	--enable-demuxer=mpc \
	--enable-demuxer=mpc8 \
	--enable-demuxer=mpegts \
	--enable-demuxer=ogg \
	--enable-demuxer=rm \
	--enable-demuxer=rtsp \
	--enable-demuxer=rtp \
	--enable-demuxer=sdp \
	--enable-demuxer=wav \
	--enable-demuxer=wv \
audio parsers :

Code: Select all

	--enable-parser=aac \
	--enable-parser=aac_latm \
	--enable-parser=ac3 \
	--enable-parser=flac \
	--enable-parser=mpegaudio \
	--enable-parser=opus \
audio protocols :

Code: Select all

	--enable-protocol=file \
--enable-protocol=http \
--enable-protocol=icecast \
--enable-protocol=rtp \
--enable-protocol=tcp \
--enable-protocol=udp \
Check out our audiophile quality crossovers : https://bit.ly/2kb1nzZ
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector

abonam
Posts: 20
Joined: Sat May 13, 2017 7:21 am

Re: Streaming from the input

Post by abonam » Wed May 24, 2017 7:14 am

Thank you!
Thats exactly what I am trying to do, so far I just run into one issue after the other.
I will follow your steps and post my progress, thanks!

Update:

Step 1: compiling only for wav
I added the

Code: Select all

enable-protocol=http
to the flags.
The ./configure complained about libwavpack.
Installed libwavpack-dev.
./configure ended up with warning
--enable-encoder(decoder)=wav did not match anything

This is not good :) as we probably will not be able to encode/decode wav.




Step 2 trying to ./configure <flag_list_for_all_the_audio_codecs>

and I get the error

speex not found using pkg-config

which it looks like has to do with the x264 libraries.
More digging to do...

abonam
Posts: 20
Joined: Sat May 13, 2017 7:21 am

Re: Streaming from the input

Post by abonam » Wed May 31, 2017 4:58 am

Hello,

I managed to get some configuration working and after trying lot of combinations server-client, I am still not able to stream the audio input with less than 1 second of latency.

I am wondering if the card itself introduces some latency and if this is not the case, what are the parameters to look at in order to minimize the audio latency?
Thanks a lot in advance for your help!

flatmax
Posts: 609
Joined: Sat Jul 23, 2016 11:39 pm

Re: Streaming from the input

Post by flatmax » Fri Jun 02, 2017 8:02 pm

Hi there,
You should be able to get ultra low latencies with this card. The problem most likely lies in the buffering for the stream.
The RTP will give the lowest latency, but for that I don't think you use the ffserver - perhaps you can ? I would be interested in finding out if you can !

Matt
Check out our audiophile quality crossovers : https://bit.ly/2kb1nzZ
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector

abonam
Posts: 20
Joined: Sat May 13, 2017 7:21 am

Re: Streaming from the input

Post by abonam » Sat Jun 03, 2017 4:24 am

Thank you !

I will try some combinations ffserver and other things and will let you know my findings.
Cheers,
Andrea

flatmax
Posts: 609
Joined: Sat Jul 23, 2016 11:39 pm

Re: Streaming from the input

Post by flatmax » Sat Jun 03, 2017 3:36 pm

This initial part of the thread talks a little about rtp :
viewtopic.php?f=5&t=64#p176

But that doesn't implement it using the ffserver.

Matt
Check out our audiophile quality crossovers : https://bit.ly/2kb1nzZ
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector

abonam
Posts: 20
Joined: Sat May 13, 2017 7:21 am

Re: Streaming from the input

Post by abonam » Thu Jun 08, 2017 11:37 am

Yes, thanks..
Ok, my problem is to stream music wit the lowest latency possible.
ffmpeg is one of the solution, but at this point i don't think it is the only solution.
RTP is needed for low latency.
I managed to measure the card latency with the ecasound command and I noticed a very low latency, about 20 ms.
The latency measured is the chain AD/DA plus the latency introduced by the ecasound command itself.
I want to find the magic combination of commands that let us to stream music almost in real-time :)
Screen Shot 2017-06-07 at 6.28.49 PM.png
Screen Shot 2017-06-07 at 6.28.49 PM.png (153.01 KiB) Viewed 5654 times

If anyone can chime in, would be really appreciated!!!

The command is:

Code: Select all

ecasound -B:rtlowlatency -b:256 -f:s16_le,2,44100 -i:alsahw,1,0 -o:alsahw,1,0

Username
Posts: 4
Joined: Thu Feb 09, 2017 11:12 am

Re: Streaming from the input

Post by Username » Wed Jul 26, 2017 3:34 am

Any updates on this? I'm looking for a sonos play 5 like line-in alternative to stream to multi-room with squeezelite. I haven't found one yet. This post could help me do what I'm looking to do.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests