Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: [CLD2WAV] How to play unsupported url/file with Command-Line Decoder and ffmpeg  (Read 3422 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[CLD2WAV] How to play unsupported url/file with Command-Line Decoder and ffmpeg

Below is a solution to play any unsupported urls or files that foobar2000 doesn't support yet with native foobar2000 decoder components.
Applies to HLS,RTSP,RTMP streams and whatever unsupported  input format that ffmpeg can decode and encode to wav. Audio

Requirements:
Command-Line Decoder Wrapper 0.4
FFmpeg Static build
and
two scripts from CLD2FFMPEG.rar. (attachment at bottom)

Issues
WindowsXP not supported.
No seeking.

Installation
For this tutorial foobar2000 is installed in portable mode at C:\foobar2000

  • Install the Command-Line Decoder Wrapper.

  • Unrar CLD2FFMPEG.rar to foobar2000 directory. C:\foobar2000\encoders\CLD2FFMPEG

  • Download FFmpeg Static build, Unrar and copy ffmpeg.exe from /bin  to C:\foobar2000\encoders\CLD2FFMPEG.

  • Rename ffmpeg.exe to CLDFFMPEG.exe



  • Now setup the Command-Line Decoder Wrapper as below:





Decode command is :
Code: [Select]
CLD2FFMPEG.cmd %s CLD2FFMPEGKILL.exe CLDFFMPEG.exe wav

  • Restart foobar2000

How to create new playlist entries.
Create a new text file and paste the url or file path that you want to play and save as Name.cld2wav
eg. BBC3.cld2wav
for
Code: [Select]
http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/nonuk/sbr_low/ak/bbc_radio_three.m3u8



A few samples are attached at the bottom in CLD.RAR.

Use one cld2wav file per url / file path.

Add the cld2wav file to the playlist and play.



Explanation:
The Command-Line Decoder Wrapper will load the file and CLD2FFMPEG.cmd  will add the url/file to CLDFFMPEG.exe (ffmpeg.exe) and pipe the output as wav.
CLD2FFMPEGKILL.exe is a autohotkey script that will monitor CLD2FFMPEG.cmd and kill CLDFFMPEG.exe when playback stops.

CLD2FFMPEG.cmd
Code: [Select]
@echo off
title CLD
FOR /F "tokens=2 delims= " %%A IN ('TASKLIST /FI ^"WINDOWTITLE eq CLD^" /NH') DO SET cld_pid=%%A
start "" "%2" %cld_pid%
set /p input=<%1
"%3" -i "%input%" -vn -f %4 - && pause

CLD2FFMPEGKILL.exe
Code: [Select]
#Persistent
DetectHiddenWindows, on

SetTimer, CheckProgram, 100
return

CheckProgram:
IfWinNotExist, ahk_pid %1%
{
Process,Close,CLDFFMPEG.exe
ExitApp
}
return

Re: [CLD2WAV] How to play unsupported url/file with Command-Line Decoder and ffmpeg

Reply #1
CLDLS2WAV
2ND Solution for Streams with  Livestreamer installed and debug logging.

Decode command is :
Code: [Select]
CLD2LSFFMPEG.cmd %s CLD2LSFFMPEGKILL.exe livestreamer.exe CLDFFMPEG.exe wav  2>CLD2LSFFMPEG.log

CLD2LSFFMPEG.cmd
Code: [Select]
@echo off
set /a cmdtitle= %random%
title %cmdtitle%
FOR /F "tokens=2 delims= " %%A IN ('TASKLIST /FI ^"WINDOWTITLE eq %cmdtitle%^" /NH') DO SET cldls_pid=%%A
start "" "%2" %cldls_pid%
set /p input=<%1
"%3" --loglevel debug -O "%input%" "audio,audio_mp4,best,worst" | "%4" -v debug -i - -f %5 -

CLD2LSFFMPEGKILL.exe
Code: [Select]
#Persistent
DetectHiddenWindows, on

SetTimer, CheckProgram, 100
return

CheckProgram:
IfWinNotExist, ahk_pid %1%
{
Process,Close,CLDFFMPEG.exe
Process,Close,livestreamer.exe
ExitApp
}
return

Re: [CLD2WAV] How to play unsupported url/file with Command-Line Decoder and ffmpeg

Reply #2
I followed the instruction and it worked via solution 1 a few days ago, but now it doesn't work anymore with playback error:
Unable to open item for playback (Could not process decoded file: Unsupported format or corrupted file):
"C:\Tools\foobar2000\CLD\BBC3.cld2wav"

Would be great if you can look into the issue.


Re: [CLD2WAV] How to play unsupported url/file with Command-Line Decoder and ffmpeg

Reply #3
I can reproduce your error when I quickly switch/play cld2wav playlist entries.

You could change the timer in the autohotkey monitor CLD2FFMPEGKILL.exe to a lower value.
or
Stop current playing entry first and then select/play another.
or
Kill CLDFFMPEG.exe from the task manager.


Re: [CLD2WAV] How to play unsupported url/file with Command-Line Decoder and ffmpeg

Reply #5
Future fb2k versions wouldn't need this workaround, only foo_input_ffmpeg, and its dependancies, nothing else.

Re: [CLD2WAV] How to play unsupported url/file with Command-Line Decoder and ffmpeg

Reply #6
..And now its public for everyone in newest FB2K beta.

Re: [CLD2WAV] How to play unsupported url/file with Command-Line Decoder and ffmpeg

Reply #7
Future fb2k versions wouldn't need this workaround, only foo_input_ffmpeg, and its dependancies, nothing else.
Thanks for clarifying that the workaround is obsolete and not required anymore and the preferred method is to use foo_input_ffmpeg.

..And now its public for everyone in newest FB2K beta.

Good news ! Thanks for the information.

Do you know perhaps know why FFmpeg Decoder Wrapper is at version 0.3.2 and got released to the public only recently?

Re: [CLD2WAV] How to play unsupported url/file with Command-Line Decoder and ffmpeg

Reply #8
Dude, there is a date in the components page.

Re: [CLD2WAV] How to play unsupported url/file with Command-Line Decoder and ffmpeg

Reply #9
Do you perhaps know why FFmpeg Decoder Wrapper is at version 0.3.2 and got released to the public only recently?
It was available for alpha testers for some time and version number has been updated along with the component changes/fixes. The feature allowing stream support for example required core changes that were only available in alpha version of foobar2000.

Re: [CLD2WAV] How to play unsupported url/file with Command-Line Decoder and ffmpeg

Reply #10
Do you perhaps know why FFmpeg Decoder Wrapper is at version 0.3.2 and got released to the public only recently?
It was available for alpha testers for some time and version number has been updated along with the component changes/fixes. The feature allowing stream support for example required core changes that were only available in alpha version of foobar2000.
Thank you @Case for the explanation.
and to all involved.

Re: [CLD2WAV] How to play unsupported url/file with Command-Line Decoder and ffmpeg

Reply #11
The feature allowing stream support for example required core changes that were only available in alpha version of foobar2000.
For me decoding of HLS and RTMP with foo_input_ffmpeg worked even with 1.3.16.


Re: [CLD2WAV] How to play unsupported url/file with Command-Line Decoder and ffmpeg

Reply #13
Hello,

I've installed  foo_input_ffmpeg  (I see it in components)
Now What I have to do to play for example this stream:

http://radiocapital-lh.akamaihd.net/i/RadioCapital_Live_1@196312/master.m3u8

Thanks

foo_input_ffmpeg documentation is here

In short:
1. Install foo_input_ffmpeg component.
2. Install ffmpeg standalone binaries.
3. From foobar2000 Preferences , go to Playback > Input > FFmpeg Decoder Wrapper and
3a. specify the ffmpeg/ffprobe binaries location and
3b. checkbox enable format HLS with file type mask http://*.m3u8;https://*.m3u8
4. From foobar2000 main menu go to File > Add location and add the url
http://radiocapital-lh.akamaihd.net/i/RadioCapital_Live_1@196312/master.m3u8
5. Play and enjoy.

 

Re: [CLD2WAV] How to play unsupported url/file with Command-Line Decoder and ffmpeg

Reply #14
Very Thanks Zeremy!