Results 21 to 30 of 35
Thread: Recording from radio stream
-
2017-08-09, 23:37 #21
- Join Date
- Sep 2015
- Posts
- 218
-
2017-12-29, 06:32 #22
- Join Date
- Apr 2013
- Location
- UK
- Posts
- 1,318
I have been thinking it would be good to timeshift radio, yes. A virtual PVR. A plugin that spins up a virtual player and pipes the stream in, encodes a flac or MP3 output file with a predictable filename on a timed basis with some sort of UI for scheduling recordings would be awesome.
Partly because some stuff doesn't make it to listen again and partly because many stations don't offer it anyway. If there's concerns about ripping of media, the files could be encrypted using an LMS generated key that would not work on another LMS instance. I.e., what a PVR does.
Transcoded from Matt's brain by Tapatalk--
Hardware: 3x Touch, 1x Radio, 2x Receivers, 1 HP Microserver NAS with Debian+LMS 7.9.0
Music: ~1300 CDs, as 450 GB of 16/44k FLACs. No less than 3x 24/44k albums..
-
2017-12-29, 07:28 #23
- Join Date
- Oct 2005
- Location
- Ireland
- Posts
- 20,090
-
2019-12-12, 13:14 #24
- Join Date
- Sep 2015
- Posts
- 218
Just come back to this having lost any configuration which may or may not have worked last time and am not getting far.
I've tried the stdout approach:
Code:squeezelite -a 16 -o - | flac - -f --best --endian=little --sign=signed --channels=2 --bps=16 --sample-rate=44100 -s -o "/var/lib/squeezeboxserver/recordings/`date +%Y%m%d_%H%M%S`.flac"
and
Code:squeezelite -a 16 -o - | arecord -f CD | flac - -f --best -s -o "/var/lib/squeezeboxserver/recordings/`date +%Y%m%d_%H%M%S`.flac"
as does this loopback approach:
Code:modprobe snd-aloop
Code:pcm.mycard { type hw card 1 } ctl.mycard { type hw card 1 } pcm.myconvert { type plug slave { pcm "myrecord" format S16_LE } } pcm.myrecord { type file format "raw" slave.pcm "mycard" file "| arecord -f CD | flac - -f --best -s -o /var/lib/squeezeboxserver/recordings/`date +%%Y%%m%%d_%%H%%M%%S`.flac" } pcm.!default{ type asym playback.pcm "myconvert" capture.pcm "mycard" }
Code:squeezelite -l X11 connection rejected because of wrong authentication. xcb_connection_has_error() returned true X11 connection rejected because of wrong authentication. xcb_connection_has_error() returned true Output devices: null - Discard all samples (playback) or generate zero samples (capture) pulse - PulseAudio Sound Server mycard myconvert myrecord default sysdefault:CARD=PCH - HDA Intel PCH, ALC283 Analog - Default Audio Device front:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - Front speakers surround21:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - 2.1 Surround output to Front and Subwoofer speakers surround40:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - 4.0 Surround output to Front and Rear speakers surround41:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - 4.1 Surround output to Front, Rear and Subwoofer speakers surround50:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - 5.0 Surround output to Front, Center and Rear speakers surround51:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - 5.1 Surround output to Front, Center, Rear and Subwoofer speakers surround71:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers iec958:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Digital - IEC958 (S/PDIF) Digital Audio Output hdmi:CARD=PCH,DEV=0 - HDA Intel PCH, HDMI 0 - HDMI Audio Output hdmi:CARD=PCH,DEV=1 - HDA Intel PCH, HDMI 1 - HDMI Audio Output hdmi:CARD=PCH,DEV=2 - HDA Intel PCH, HDMI 2 - HDMI Audio Output hdmi:CARD=PCH,DEV=3 - HDA Intel PCH, HDMI 3 - HDMI Audio Output hdmi:CARD=PCH,DEV=4 - HDA Intel PCH, HDMI 4 - HDMI Audio Output dmix:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - Direct sample mixing device dmix:CARD=PCH,DEV=1 - HDA Intel PCH, ALC283 Digital - Direct sample mixing device dmix:CARD=PCH,DEV=3 - HDA Intel PCH, HDMI 0 - Direct sample mixing device dmix:CARD=PCH,DEV=7 - HDA Intel PCH, HDMI 1 - Direct sample mixing device dmix:CARD=PCH,DEV=8 - HDA Intel PCH, HDMI 2 - Direct sample mixing device dmix:CARD=PCH,DEV=9 - HDA Intel PCH, HDMI 3 - Direct sample mixing device dmix:CARD=PCH,DEV=10 - HDA Intel PCH, HDMI 4 - Direct sample mixing device dsnoop:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - Direct sample snooping device dsnoop:CARD=PCH,DEV=1 - HDA Intel PCH, ALC283 Digital - Direct sample snooping device dsnoop:CARD=PCH,DEV=3 - HDA Intel PCH, HDMI 0 - Direct sample snooping device dsnoop:CARD=PCH,DEV=7 - HDA Intel PCH, HDMI 1 - Direct sample snooping device dsnoop:CARD=PCH,DEV=8 - HDA Intel PCH, HDMI 2 - Direct sample snooping device dsnoop:CARD=PCH,DEV=9 - HDA Intel PCH, HDMI 3 - Direct sample snooping device dsnoop:CARD=PCH,DEV=10 - HDA Intel PCH, HDMI 4 - Direct sample snooping device hw:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - Direct hardware device without any conversions hw:CARD=PCH,DEV=1 - HDA Intel PCH, ALC283 Digital - Direct hardware device without any conversions hw:CARD=PCH,DEV=3 - HDA Intel PCH, HDMI 0 - Direct hardware device without any conversions hw:CARD=PCH,DEV=7 - HDA Intel PCH, HDMI 1 - Direct hardware device without any conversions hw:CARD=PCH,DEV=8 - HDA Intel PCH, HDMI 2 - Direct hardware device without any conversions hw:CARD=PCH,DEV=9 - HDA Intel PCH, HDMI 3 - Direct hardware device without any conversions hw:CARD=PCH,DEV=10 - HDA Intel PCH, HDMI 4 - Direct hardware device without any conversions plughw:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - Hardware device with all software conversions plughw:CARD=PCH,DEV=1 - HDA Intel PCH, ALC283 Digital - Hardware device with all software conversions plughw:CARD=PCH,DEV=3 - HDA Intel PCH, HDMI 0 - Hardware device with all software conversions plughw:CARD=PCH,DEV=7 - HDA Intel PCH, HDMI 1 - Hardware device with all software conversions plughw:CARD=PCH,DEV=8 - HDA Intel PCH, HDMI 2 - Hardware device with all software conversions plughw:CARD=PCH,DEV=9 - HDA Intel PCH, HDMI 3 - Hardware device with all software conversions plughw:CARD=PCH,DEV=10 - HDA Intel PCH, HDMI 4 - Hardware device with all software conversions sysdefault:CARD=Loopback - Loopback, Loopback PCM - Default Audio Device front:CARD=Loopback,DEV=0 - Loopback, Loopback PCM - Front speakers surround21:CARD=Loopback,DEV=0 - Loopback, Loopback PCM - 2.1 Surround output to Front and Subwoofer speakers surround40:CARD=Loopback,DEV=0 - Loopback, Loopback PCM - 4.0 Surround output to Front and Rear speakers surround41:CARD=Loopback,DEV=0 - Loopback, Loopback PCM - 4.1 Surround output to Front, Rear and Subwoofer speakers surround50:CARD=Loopback,DEV=0 - Loopback, Loopback PCM - 5.0 Surround output to Front, Center and Rear speakers surround51:CARD=Loopback,DEV=0 - Loopback, Loopback PCM - 5.1 Surround output to Front, Center, Rear and Subwoofer speakers surround71:CARD=Loopback,DEV=0 - Loopback, Loopback PCM - 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers dmix:CARD=Loopback,DEV=0 - Loopback, Loopback PCM - Direct sample mixing device dmix:CARD=Loopback,DEV=1 - Loopback, Loopback PCM - Direct sample mixing device dsnoop:CARD=Loopback,DEV=0 - Loopback, Loopback PCM - Direct sample snooping device dsnoop:CARD=Loopback,DEV=1 - Loopback, Loopback PCM - Direct sample snooping device hw:CARD=Loopback,DEV=0 - Loopback, Loopback PCM - Direct hardware device without any conversions hw:CARD=Loopback,DEV=1 - Loopback, Loopback PCM - Direct hardware device without any conversions plughw:CARD=Loopback,DEV=0 - Loopback, Loopback PCM - Hardware device with all software conversions plughw:CARD=Loopback,DEV=1 - Loopback, Loopback PCM - Hardware device with all software conversions
and starting squeezelite with:
Code:squeezelite -o myrecord
Last edited by Learnincurve; 2019-12-12 at 13:18.
-
2019-12-12, 13:28 #25
- Join Date
- Oct 2005
- Location
- Ireland
- Posts
- 20,090
Start simple.
Does stdout approach save PCM OK to a file - that can be played back later ?
Remember - any output file format that has a header may not be complete as when you stop recording - buffer will be flushed but the header at the start of the file may not be updated.Last edited by bpa; 2019-12-12 at 13:30.
-
2019-12-12, 14:01 #26
- Join Date
- Sep 2015
- Posts
- 218
Well I did try:
squeezelite -o - > /var/lib/squeezeboxserver/recordings/raw.wav
but that had already written a 44GB file before I managed to turn it off. I forgot the -a 16 and it didn't play back. Source file for testing is from a 16bit 44100Hz CD rip.
After that I decided to try saving the ssd and going for smaller files.
-
2019-12-12, 14:12 #27
- Join Date
- Oct 2005
- Location
- Ireland
- Posts
- 20,090
WAV file have header - stdout produced a PCM file with no header so no woinder it will nto play.
However unless I think you have forced squeezelite to produce CD quality - the PCM will be whatevver the source (e.g. 44.kHz for many radio but 48kHz for some other - with no header - the file will be unplayabale)
I think you need to tell squeezelite to output CD quality and let LMS do transcoding / upsampling etc. to get CD (16bits 2 chan 44.1khz).
edit:
Just to be sure - should check squeezelite source to see what default output audio format is used for stdout.
edit2:
default with no args is S32_le and 44.1khz. So -a 16 is required to give CD quality. Any player will need to be told that file is PCM (not WAV) stream is in S16le 44.1kHzformat.Last edited by bpa; 2019-12-12 at 14:21.
-
2019-12-13, 13:08 #28
- Join Date
- Sep 2015
- Posts
- 218
Thanks for those pointers. I am getting closer but some problems remain.
I tried -a 16 with:
squeezelite -a 16 -o - > "/var/lib/squeezeboxserver/recordings/`date +%Y%m%d_%H%M%S`.pcm"
with similar problems: the output file is very large and cannot be played.
When playing a source file into the squeezelite started with the above parameters -in this case a CD-rip to flac:
File Format: FLAC
Duration: 7:29
Bitrate: 643kbps VBR
Sample Rate: 44.1 kHz
Sample Size: 16Bits
The progress slider jumps forward very fast, so a 7.5 minute track plays in a few seconds and pregresses to the next.
The resultant .pcm file was very large (about 19GB after a minute) and refused to play at all (play button refused to activate),
After that I decided to try ffmpeg:
Code:squeezelite -a 16 -o - | ffmpeg -f s16le -ar 44100 -ac 2 -i pipe: -c:a flac "/var/lib/squeezeboxserver/recordings/`date +%Y%m%d_%H%M%S`.flac" ffmpeg version 4.0.4-0ubuntu1 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8 (Ubuntu 8.2.0-7ubuntu1) configuration: --prefix=/usr --extra-version=0ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 56. 14.100 / 56. 14.100 libavcodec 58. 18.100 / 58. 18.100 libavformat 58. 12.100 / 58. 12.100 libavdevice 58. 3.100 / 58. 3.100 libavfilter 7. 16.100 / 7. 16.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 1.100 / 5. 1.100 libswresample 3. 1.100 / 3. 1.100 libpostproc 55. 1.100 / 55. 1.100 Guessed Channel Layout for Input Stream #0.0 : stereo Input #0, s16le, from 'pipe:': Duration: N/A, bitrate: 1411 kb/s Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s Stream mapping: Stream #0:0 -> #0:0 (pcm_s16le (native) -> flac (native)) Output #0, flac, to '/var/lib/squeezeboxserver/recordings/20191213_201516.flac': Metadata: encoder : Lavf58.12.100 Stream #0:0: Audio: flac, 44100 Hz, stereo, s16, 128 kb/s Metadata: encoder : Lavc58.18.100 flac ^Csize= 203578kB time=30:23:58.22 bitrate= 15.2kbits/s speed= 425x video:0kB audio:203570kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.003976% Exiting normally, received signal 2.
The squeezelite I'm using is the default Ubuntu package, so don't have the source. You mentioned letting LMS do the upsampling but I can't see where to do that. I did play with C3PO once before and could use sox options for the output, but know very little about sox too. Whatever options I use, it would be good if they were specific to that squeezelite, so that my regular listening setup isn't affected.
-
2019-12-13, 13:25 #29
- Join Date
- Oct 2005
- Location
- Ireland
- Posts
- 20,090
You must know how to play the file before you can convert it.
If you cannot play it - then you will make assumptions on its format like you ffmpeg command. These assumption may be incorrect.
What and how are you using to to play the file ?
On a Linux box, usually I use aplay and standard audio output that is known to work with aplay with a known file (e.g. a WAV file created from a flac / MP3 /AAC file).
-
2019-12-13, 13:52 #30
- Join Date
- Oct 2005
- Location
- Ireland
- Posts
- 20,090
It may be that squeezelite could be outputting silence and it is being saved to a file and so file grows.
Here is the initial post for the feature.
https://forums.slimdevices.com/showt...l=1#post762055