Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom decoder for streams #14

Closed
smimram opened this issue Jan 27, 2013 · 4 comments · Fixed by #16
Closed

Add support for custom decoder for streams #14

smimram opened this issue Jan 27, 2013 · 4 comments · Fixed by #16
Assignees
Milestone

Comments

@smimram
Copy link
Member

smimram commented Jan 27, 2013

From the ML:

I try to add an external decoder using ffmpeg, to add more supported
format on input stream (accp, mms, rtsp, ..).

I make a very simple test with an AUDIO/AACP input stream :

def test_ffmpeg(file) =
     int_of_string("-1")
end


ffmpeg_p = "< /dev/null /usr/bin/ffmpeg -i - -"
add_decoder(name="FFMPEG",description="Decode files using the ffmpeg
decoder binary",test=test_ffmpeg, ffmpeg_p)

set("decoder.mime_types.aac",["audio/aac","audio/aacp","audio/x-hx-aac-adts"])
set("decoder.stream_decoders",["WAV","PCM/BASIC","FLAC","OGG","MAD","FFMPEG"])

source = input.http(
         autostart=true,

"http://mp3kh.live.tv-radio.com/3266/urban-mix/urban-mix-aac.mp3"
)

source = mksafe(source)

[....]

But liquidsoap never find my FFMPEG decoder ...

2013/01/25 11:25:56 [decoder:2] Cannot find decoder FFMPEG
2013/01/25 11:25:56 [decoder:3] Unable to decode stream of type
"audio/aacp"!

Have you any idea, or conf. sample ? or perhaps external decoder
running only on file ? and not on a stream ?

Romain answered:

This made me realize that custom decoders are not currently supported
for streams. Streams decoders are picked up according to mime types
that they support. However, there is no way to specify which mime type
your custom decode supports, so it will never be picked..

@smimram
Copy link
Member Author

smimram commented Jan 27, 2013

There was a pb with headers produced by ffmpeg, fixed in 6059b3d.

I can now run

def test_ffmpeg(file) = -1 end

ffmpeg_p = "/usr/bin/ffmpeg -i - -f wav -"
add_decoder(name="FFMPEG",description="Decode files using the ffmpeg decoder binary",mimes=["audio/aacp"],test=test_ffmpeg,ffmpeg_p)

set("decoder.stream_decoders",["FFMPEG"])

s = input.http(autostart=true,"http://mp3kh.live.tv-radio.com/3266/urban-mix/urban-mix-aac.mp3")
s = mksafe(s)
output.pulseaudio(s)

But there is a problem with corrupted fd at shutdown.

@toots
Copy link
Member

toots commented Jan 30, 2013

Done now.

@toots toots closed this as completed Jan 30, 2013
@mylselgan
Copy link

Installed Liquidsoap 1.2.0 by OPAM method

here is my script

#!/usr/bin/liquidsoap
set("log.file.path","test.log")
set("log.stdout",true)
set("log.level", 5)

def test_ffmpeg(file) = -1 end

ffmpeg_p = "/usr/bin/ffmpeg -i - -f wav -"
add_decoder(name="FFMPEG",description="Decode files using the ffmpeg decoder binary",mimes=["application/vnd.apple.mpegurl"],test=test_ffmpeg,ffmpeg_p)

set("decoder.stream_decoders",["FFMPEG"])
s = input.http(autostart=true, "http://eno.emit.com:1935/live/7edg_aac_64.stream/playlist.m3u8")
s = mksafe(s)

output.shoutcast(s)

Log Output

radio@vps287067:~/liquidsoap$ 2016/07/08 12:11:34 >>> LOG START
2016/07/08 12:11:34 [protocols.external:3] Found "/home/radio/.opam/system/lib/liquidsoap/lib/liquidsoap/1.2.0/liquidget".
2016/07/08 12:11:34 [main:3] Liquidsoap 1.2.0
2016/07/08 12:11:34 [main:3] Using: bytes=[distributed with OCaml 4.02 or above] pcre=7.2.3 dtools=0.3.2 duppy=0.5.2 duppy.syntax=0.5.2 cry=0.3.0 mm=0.3.0 ogg=0.5.0 vorbis=0.6.2 mad=0.4.5 dynlink=[distributed with Ocaml] lame=0.3.3 gstreamer=0.2.1 taglib=0.3.2 camomile=0.8.5
2016/07/08 12:11:34 [dynamic.loader:3] Could not find dynamic module for fdkaac encoder.
2016/07/08 12:11:34 [dynamic.loader:3] Could not find dynamic module for aacplus encoder.
2016/07/08 12:11:34 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz master.
2016/07/08 12:11:34 [frame:3] Frame size must be a multiple of 1764 ticks = 1764 audio samples = 1 video samples.
2016/07/08 12:11:34 [frame:3] Targetting 'frame.duration': 0.04s = 1764 audio samples = 1764 ticks.
2016/07/08 12:11:34 [frame:3] Frames last 0.04s = 1764 audio samples = 1 video samples = 1764 ticks.
2016/07/08 12:11:34 [video.converter:4] Couldn't find preferred video converter: gavl.
2016/07/08 12:11:34 [audio.converter:4] Couldn't find preferred samplerate converter: libsamplerate.
2016/07/08 12:11:34 [audio.converter:4] Using native samplerate converter
2016/07/08 12:11:34 [threads:3] Created thread "generic queue #1".
2016/07/08 12:11:34 [threads:3] Created thread "generic queue #2".
2016/07/08 12:11:34 [clock:4] Currently 1 clocks allocated.
2016/07/08 12:11:34 [clock.wallclock_main:4] Starting 1 sources...
2016/07/08 12:11:34 [source:4] Source output(dot)shoutcast gets up.
2016/07/08 12:11:34 [source:4] Source mksafe gets up.
2016/07/08 12:11:34 [source:4] Source http_5285 gets up.
2016/07/08 12:11:34 [http_5285:4] Content kind is {audio=2;video=0;midi=0}.
2016/07/08 12:11:34 [threads:3] Created thread "http polling" (1 total).
2016/07/08 12:11:34 [http_5285:4] Activations changed: static=[], dynamic=[mksafe:output(dot)shoutcast:output(dot)shoutcast].
2016/07/08 12:11:34 [source:4] Source safe_blank gets up.
2016/07/08 12:11:34 [safe_blank:4] Content kind is {audio=2;video=0;midi=0}.
2016/07/08 12:11:34 [safe_blank:4] Activations changed: static=[], dynamic=[mksafe:output(dot)shoutcast:output(dot)shoutcast].
2016/07/08 12:11:34 [mksafe:4] Activations changed: static=[output(dot)shoutcast:output(dot)shoutcast], dynamic=[].
2016/07/08 12:11:34 [output(dot)shoutcast:4] Activations changed: static=[output(dot)shoutcast], dynamic=[].
2016/07/08 12:11:34 [output(dot)shoutcast:4] Enabling caching mode: active source.
2016/07/08 12:11:34 [output(dot)shoutcast:3] Connecting mount / for source@164.132.63.75...
2016/07/08 12:11:34 [http_5285:4] Connecting to http://eno.emit.com:1935/live/7edg_aac_64.stream/playlist.m3u8...
2016/07/08 12:11:34 [output(dot)shoutcast:3] Connection setup was successful.
2016/07/08 12:11:34 [threads:3] Created thread "wallclock_main" (2 total).
2016/07/08 12:11:34 [clock:4] Main phase starts.
2016/07/08 12:11:34 [clock.wallclock_main:3] Streaming loop starts, synchronized with wallclock.
2016/07/08 12:11:34 [mksafe:3] Switch to safe_blank.
2016/07/08 12:11:34 [safe_blank:4] Activations changed: static=[mksafe:output(dot)shoutcast:output(dot)shoutcast], dynamic=[mksafe:output(dot)shoutcast:output(dot)shoutcast].
2016/07/08 12:11:34 [http_5285:4] Content-type "application/vnd.apple.mpegurl".
2016/07/08 12:11:34 [http_5285:4] Trying playlist parser for mime application/vnd.apple.mpegurl
2016/07/08 12:11:34 [decoder:4] Trying method "FFMPEG" for "application/vnd.apple.mpegurl"...
2016/07/08 12:11:34 [decoder:3] Method "FFMPEG" accepted "application/vnd.apple.mpegurl".
2016/07/08 12:11:34 [http_5285:3] Decoding…
ffmpeg version 2.8.6-1ubuntu2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.3.1 (Ubuntu 5.3.1-11ubuntu1) 20160311
configuration: --prefix=/usr --extra-version=1ubuntu2 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --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-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
2016/07/08 12:11:34 [http_5285:4] No network activity for 1.00 second(s).
2016/07/08 12:11:34 [http_5285:4] No network activity for 1.00 second(s).
2016/07/08 12:11:34 [http_5285:4] No network activity for 1.00 second(s).
2016/07/08 12:11:34 [http_5285:4] No network activity for 1.00 second(s).
2016/07/08 12:11:34 [http_5285:4] No network activity for 1.00 second(s).
2016/07/08 12:11:34 [http_5285:4] No network activity for 1.00 second(s).
2016/07/08 12:11:34 [http_5285:4] No network activity for 1.00 second(s).
kill2016/07/08 12:11:34 [http_5285:4] No network activity for 1.00 second(s).
all 2016/07/08 12:11:34 [http_5285:4] No network activity for 1.00 second(s).
pipe:: No such file or directory
2016/07/08 12:11:43 [http_5285:2] Feeding stopped: Wav_aiff_decoder.End_of_stream
...
Silent output comes.

@jonahzheng
Copy link

@mylselgan Liquidsoap does not yet support input sources for hls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants