HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: Peter on 2012-10-11 10:01:18

Title: Command-Line Decoder Wrapper
Post by: Peter on 2012-10-11 10:01:18
Summary
This component allows you to comfortably play or convert any audio format with a standalone command-line decoder available, including various exotic formats that do not have native foobar2000 decoder components.
Check the documentation link below for more details.

Links
Home page (http://www.foobar2000.org/components/view/foo_input_exe)
Documentation (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Components_0.9/Command-Line_Decoder_Wrapper_%28foo_input_exe%29)

Have fun.
Title: Command-Line Decoder Wrapper
Post by: Peter on 2012-10-11 10:10:01
Attached: configuration file (work-in-progress), thanks to Case
Currently supported formats:
* LA
* LPAC

You can import this thru the preferences page.
Title: Command-Line Decoder Wrapper
Post by: CoRoNe on 2012-10-11 20:15:13
Thanks a lot. No problems playing LA-files.
BUT, I have this habit of putting the version number in the file name like this: la (Lossless Audio Compressor 0.4b).exe.
Where as la.exe -cout %s (with the binary renamed accordingly of course) works just fine, "la (Lossless Audio Compressor 0.4b).exe" -cout %s does not. Entering the full path of the binary, "D:\Storage\Media\Binaries\la (Lossless Audio Compressor 0.4b).exe" -cout %s seems to be the only way to get it working.
Title: Command-Line Decoder Wrapper
Post by: Peter on 2012-10-11 21:58:10
New version out, misbehavior on space in exe file name fixed. Thanks for reporting.
Title: Command-Line Decoder Wrapper
Post by: Anakunda on 2012-10-12 13:31:08
Hi!

Thank you for versatile decoder. Curious if this could be somehow helpful in direct playing of DTS-HD and TrueHD audio files?
The command line for piped decoding is eac3to input.dtshd stdout.wav
The command line for non-piped decoding is eac3to %s %d this i'm afraid however generates a HUGE temp file in the source folder (expectingly 10-20gb in size) which also takes quite a long time before playbak start depending on the drive throughput. I want to avoid this and rather play via pipe ie. no temp wav files creating ....any thoughts..............
Title: Command-Line Decoder Wrapper
Post by: Rollin on 2012-10-12 17:50:30
Thanks for this component! 
Is it possible to add option to write mp4 tags?

The command line for non-piped decoding is eac3to %s %d this i'm afraid however generates a HUGE temp file in the source folder (expectingly 10-20gb in size) which also takes quite a long time before playbak start depending on the drive throughput. I want to avoid this and rather play via pipe ie. no temp wav files creating ....any thoughts..............

I have no problems using eac3to.exe %s stdout.wav for dtshd 24/96 playback.
Title: Command-Line Decoder Wrapper
Post by: Peter on 2012-10-12 21:20:39
Is it possible to add option to write mp4 tags?

If there's a scenario where that makes sense (MP4 files that are not decoded by the native MP4 handler - what file type exactly?), sure why not.
Title: Command-Line Decoder Wrapper
Post by: Rollin on 2012-10-13 15:47:26
MP4 files that are not decoded by the native MP4 handler - what file type exactly?

MPEG-4 ALS in MP4 container.
Title: Command-Line Decoder Wrapper
Post by: Peter on 2012-11-09 09:31:49
Split. (http://www.hydrogenaudio.org/forums/index.php?showtopic=97788)
Title: Command-Line Decoder Wrapper
Post by: romor on 2013-01-16 02:53:19
I wanted to provide example for decoding two files simultaneously, hopefully as some sort of temporal solution to a thread asking for lossywav correction playback. Then noticed that this component, same as converter, doesn't allow using title formatting functions for input line. Because of that I created batch file (soxdec.cmd):

Code: [Select]
@echo off
set input=%~1
sox -m %1 "%input:lossy.flac=lwcdf.flac%" -t .wav -

and instruct decoder to: "soxdec.cmd %s"

It works fine but sox process isn't terminated on playback stop.

If I use sox directly in decoder input line: "sox %s -t .wav -" then decoder closes sox process as expected.
Title: Command-Line Decoder Wrapper
Post by: EpicForever on 2013-02-02 17:28:03
I'm not sure weather this issue is caused by foo_input_exe or foo_dsp_effect so I post it in both threads, maybe authors will find what can be wrong.
My DSP chain looks like this: Skip Silence - > convert 5.1 to stereo -> convert mono to stereo -> playback rate shift. Playback Rate Shift requires 2ch signal. So used DSP effects provide such signal.
When I play 6ch FLAC encoded from DVD-A everything works OK. Signal is downmixed and I can use PRS actively or just unused, but present in chain. But when I play audio from video files and I use foo_input_exe to wrap signal decompressed by FFMPEG.exe from that files, then 6ch audio decoded from .VOB file generates error: "Unrecoverable playback error: Illegal number of channels". It means that Playback Rate Shift gets 6ch audio instead of 2ch - like "convert 5.1 to stereo" wasn't working or something like this... Why? What can I do to avoid this error in such playback configuration?
Title: Command-Line Decoder Wrapper
Post by: Rollin on 2013-02-02 17:53:13
The reason is ffmpeg. Not foo_input_exe, not foo_dsp_effect and not "convert 5.1 to stereo dsp".
You can downmix with ffmpeg itself using -ac 2 or -channel_layout downmix
E.g.: ffmpeg.exe -i %s -vn -ac 2 -f wav -
        ffmpeg.exe -i %s -vn -channel_layout downmix -f wav -
Title: Command-Line Decoder Wrapper
Post by: EpicForever on 2013-02-02 19:24:32
Hm... I thought that it goes like this:
1. foobar sends command to ffmpeg to simply create PCM wav on my HDD
2. ffmpeg decodes audio, creates wav and lets foobar open it (sends output file name and path to foobar)
3. foobar simply plays wav from my HDD - like every other file - eg 6ch FLAC from DVD-A.
4. this implies that file (to be exact - decoded bitstream with audio) goes through consecutive chain of DSPs - like every other file - eg 6ch FLAC from DVD-A.
5. this implies that before Playback Rate Shift DSP is used, decoded audio should be 2ch bistream (downmixed from 5.1)...

Then why I have to downmix to 2ch before wav is opened in foobar? Or maybe I am wrong and something works differently when ffmpeg or foo_input_exe is used?
Title: Command-Line Decoder Wrapper
Post by: lvqcl on 2013-02-02 19:50:36
Looks like "Convert 5.1 to stereo" plugin doesn't recognize the audio as 5.1.

I created a file with "6: FL FR FC LFE SL SR" channel mask and indeed it wasn't downmixed. A file with "6: FL FR FC LFE BL BR" channel mask was recognized as 5.1.

So, "Convert 5.1 to stereo" plugin doesn't like 5.1 with side channels.
Title: Command-Line Decoder Wrapper
Post by: EpicForever on 2013-02-02 22:53:54
Hm... Maybe ffmpeg uses that "wrong" channel masks in output wav file... Then I have to choose between loading PRS to chain each time I want to use it or remove multichannel functionality in audio from video files by "hardcoding" it with appropiate command line switch in ffmpeg... Or - maybe I should post another "Request post" on foobar forum  . "Convert 5.1 to stereo" is part of standard DSP array, isn't it ?

As foobar reads:
"Standard DSPs for foobar2000
© 2002-2012 Peter Pawlowski
Advanced limiter by MTRH
5.1 Downmix by Garf".
Title: Command-Line Decoder Wrapper
Post by: CoRoNe on 2013-02-03 11:29:34
EpicForever: Although Rollin's suggestion works just fine for ffmpeg, you could give foo_channel_mixer (http://skipyrich.com/wiki/Foobar2000:Channel_Mixer) a try as a permanent solution for Playback Rate Shift. Works in all cases; 6ch FLACs decoded by foobar itself and 6ch movie-clips by ffmpeg. I've been happily using foo_channel_mixer and Pitch Shift (foo_dsp_effect) for some time now myself.
Title: Command-Line Decoder Wrapper
Post by: Peter on 2013-02-03 12:28:36
Channel order handling in downmix DSP changed in foobar2000 1.2.3.
Title: Command-Line Decoder Wrapper
Post by: EpicForever on 2013-02-03 12:39:57
Peter - thank you for permanent (I hope  )workaround, CoRoNe - thank you for suggestion.
Title: Command-Line Decoder Wrapper
Post by: mariner on 2014-07-20 01:29:31
Good morning:

I have problems with packMP3 files (*.PMP): I can't seem to configure well the Command-Line Decoder Wraper, for I can't hear  nothing when I open a .PMP. Here is my configuration:

(http://s16.postimg.org/3pk4hj345/comm.png)

(http://s27.postimg.org/olyzapkyr/set.png)

(packMP3.exe is on the main folder of foobar)
A zero-bytes file is created when I try to play the archive. Also, I get this error within a pop-up window:

Unable to open item for playback (Unexpected decoding failure, no output file was created)

Can anybody help me? Excuse me if this is no place for this kind of questions!
Title: Command-Line Decoder Wrapper
Post by: lvqcl on 2014-07-20 09:39:58
Try decode command:
Code: [Select]
packMP3.exe -
Title: Command-Line Decoder Wrapper
Post by: Case on 2014-07-20 18:14:52
mariner, you need to create a simple wrapper batch file to be able to use packMP3. Put this command in the batch file (you can call it for example packmp3.cmd): @if not ."%~2" == ."" packmp3.exe -np - < "%~1" > "%~2"
and use this as Decode command: packmp3.cmd %s %d
Title: Command-Line Decoder Wrapper
Post by: mariner on 2014-07-21 02:56:17
mariner, you need to create a simple wrapper batch file to be able to use packMP3. Put this command in the batch file (you can call it for example packmp3.cmd): @if not ."%~2" == ."" packmp3.exe -np - < "%~1" > "%~2"
and use this as Decode command: packmp3.cmd %s %d


Thanks for your responses, lvqcl & Case. And yes, that's how it finally works ok! I feel that it's very slow when processing songs (a big buffer timing helps a lot, but i refer to the whole process of decoding and the first song to play). But I suppose this is the fastest it can be, so there's nothing to worry about. I think I'm gonna compress most of my discography with packMP3, in order to save space.

Thank you very much, I was going mad with the syntax thing!
Title: Command-Line Decoder Wrapper
Post by: Skif_off on 2014-11-08 11:33:17
How can I use folder foobar2000/encoders for decoders (for portable mode without full path)?
Title: Command-Line Decoder Wrapper
Post by: Skif_off on 2014-11-30 15:29:08
I put ffmpeg.exe next to foobar2000.exe and it's solved the problem.
Title: Re: Command-Line Decoder Wrapper
Post by: arch21 on 2017-03-02 15:42:23
With mpv
Code: [Select]
mpv.exe %s -of=wav -o -
Title: Re: Command-Line Decoder Wrapper
Post by: arch21 on 2017-10-21 03:54:03
hi, on components page, it has been updated to version 0.5 but it still shows version 0.4 on preferences page.
Title: Re: Command-Line Decoder Wrapper
Post by: EpicForever on 2017-11-18 10:40:47
I have small suggestion. Would it be possible, to have in configuration of the plugin checkboxes next to each format name, similarly to what is present in foo_input_ffmpeg? That would allow for very convenient switching between wrapper / ffmpeg wrapper / native decoding of some formats  just by unchecking / checking boxes.
Title: Re: Command-Line Decoder Wrapper
Post by: WiAIeonn on 2021-01-13 17:58:36
hi. trying to use this wrapper with youtube-dl (https://youtube-dl.org/).
made this configuration for file containing url(ex. :https://soundcloud.com/seppe-renders-184158590/dj-rendazz-ride-it-riddim-2020-ft)
X
it works, but playback starts when download finished.

i tried to change "decode command" from using temp file:
Code: [Select]
youtube-dl -a %s -o %d
to using stdout:
Code: [Select]
youtube-dl -a %s -o -

for instant playback,
but get this error:
Code: [Select]
Unable to open item for playback (Could not process decoded file: Object is not seekable):
"...\file.mpscyt"
is it possible to fix this ? (tried this command with vlc player - playing without errors)
Title: Re: Command-Line Decoder Wrapper
Post by: MojoBass on 2021-01-14 06:42:46
Not sure what exactly you want to do... if you just want to download the mp3 from soundcloud with youtube-dl within foobar, maybe foo_run can help, see here (https://hydrogenaud.io/index.php?topic=45223.msg983915#msg983915).
Title: Re: Command-Line Decoder Wrapper
Post by: kode54 on 2021-01-15 05:21:30
I'm guessing the soundcloud high quality download script requires a seekable output file, so it won't work with stdout piping.
Title: Re: Command-Line Decoder Wrapper
Post by: WiAIeonn on 2021-01-16 12:03:11
Not sure what exactly you want to do... if you just want to download the mp3 from soundcloud with youtube-dl within foobar, maybe foo_run can help, see here (https://hydrogenaud.io/index.php?topic=45223.msg983915#msg983915).

iam trying to figure out way to play files from soundcloud, without downloading them first, cause foo_youtube refuse to do it
(for example https://soundcloud.com/user-214161121/nomad):
Code: [Select]
[14:22:22] Opening track for playback: "soundcloud.com/user-214161121/nomad"
[14:22:27] foo_youtube: [warning] unexpected 'ext' field: wav
[14:22:27] foo_youtube: [audio] opening 93mb 2756kbps
[14:22:29] foo_youtube: [error] Invalid data found when processing input
[14:22:29] foo_youtube: [warning] [audio] opening, decoder foo_youtube: Invalid data found when processing input
[14:22:29] foo_youtube: [warning] [audio] opening, decoder foobar2000: Unsupported file format
[14:22:31] foo_youtube: [error] Invalid data found when processing input
[14:22:31] foo_youtube: [warning] [audio] opening, decoder ffmpeg: Invalid data found when processing input
[14:22:31] Unable to open item for playback (Youtube Source: foo_youtube: Invalid data found when processing input | foobar2000: Unsupported file format | ffmpeg: Invalid data found when processing input):
"soundcloud.com/user-214161121/nomad"
.

youtube-dl gives valid link:
Code: [Select]
youtube-dl -g https://soundcloud.com/user-214161121/nomad
https://cf-media.sndcdn.com/yOlShEjXelNX?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20veU9sU2hFalhlbE5YIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjEwNzk2NDI1fX19XX0_&Signature=OY2HcMtg3KKbrFE1uvYilkw6XcpCauf6IfHuwWpmC5NKZD7QtqrWPNlbSG8NHxmKJuaYrXiZMVgRBuJflld99Jyqd~YCGOmdJKU8~DFtsmc7T0azMqXEd4TbjadR9SpJdmzSqR1ug4giDaP3ECataREVrqEn-mMDyJYwO7Tb~35Jq~3EhOjy3fqfgPwQBTQr2iJmmeNOUqwQqMhElb3FD0QN13LUb23VeHlHeTM-64ZAFGDwybxvemT5wkv9M~J1IJ94ptrMEZHWp6RBOEjoDvtsLiOIDjZ8NuZ5GeFtfJuXbw76mxMfnCuVzYbB5yCTM3xvw3G~pOzKh7qZoHI~iQ__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ

and foobar opens it without problems:
Code: [Select]
[14:26:51] Opening track for playback: "https://cf-media.sndcdn.com/yOlShEjXelNX?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20veU9sU2hFalhlbE5YIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjEwNzk2NDI1fX19XX0_&Signature=OY2HcMtg3KKbrFE1uvYilkw6XcpCauf6IfHuwWpmC5NKZD7QtqrWPNlbSG8NHxmKJuaYrXiZMVgRBuJflld99Jyqd~YCGOmdJKU8~DFtsmc7T0azMqXEd4TbjadR9SpJdmzSqR1ug4giDaP3ECataREVrqEn-mMDyJYwO7Tb~35Jq~3EhOjy3fqfgPwQBTQr2iJmmeNOUqwQqMhElb3FD0QN13LUb23VeHlHeTM-64ZAFGDwybxvemT5wkv9M~J1IJ94ptrMEZHWp6RBOEjoDvtsLiOIDjZ8NuZ5GeFtfJuXbw76mxMfnCuVzYbB5yCTM3xvw3G~pOzKh7qZoHI~iQ__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ"
X
but only once, next time:
Code: [Select]
[14:30:28] Unable to open item for playback (Access denied):
"https://cf-media.sndcdn.com/yOlShEjXelNX?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20veU9sU2hFalhlbE5YIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjEwNzkzMTk5fX19XX0_&Signature=XMgHDPp9VBRaRsDK12IyBF~62Uh6aPioHPce2j0w5par2RhiWD8pdAjrxgxxY6XC7bOB9NQRqgwPnR35-c1M-4uRFq6oa8VNSb7HqaB1NVyAjUAE2EKAOlYCPTt5ekFptZET3wHGM1PGIeSWcqUaV8jcmgiptoc69XT5yJ0U-c7HtaxObAL6NmF4f6V8JWbfH4gvmAAi08UF1ymjZK~F2ywdCTy8mRef3tb4XHXStLsjwV32pTG7grfX4VxtMgmLfsaWirmM9BmaJauAqNug79OhwU8ddw3LF2HndL7gmH4NCX5-WUrGcbPwi4ANFvV3bdfcpc~aWqRV4XDn3af2Cg__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ"

thats why i tried to use Command-Line Decoder Wrapper as described above. i need somehow to extract valid link when playback starts and supply it to foobar.
Title: Re: Command-Line Decoder Wrapper
Post by: MojoBass on 2021-01-16 13:45:01
I can play your link without any problems in foobar via File -> Youtube Source -> Add Multiple URLs...  It is played as mp3 (I have seen that it is as well available as wav from soundcloud).
Are you sure you are having latest foo_youtube and youtube-dl installed?
Title: Re: Command-Line Decoder Wrapper
Post by: WiAIeonn on 2021-01-16 13:53:57
try this: https://soundcloud.com/djcquence/cquence-refractions-of-the-spherical-groove-004
can foo_youtube open 320 kbps stream?
Title: Re: Command-Line Decoder Wrapper
Post by: MojoBass on 2021-01-16 18:03:04
Sure - plays flawless with 320 kbps on my side