inputstream.ffmpegdirect icon indicating copy to clipboard operation
inputstream.ffmpegdirect copied to clipboard

[HELP] playing raw PCM audio

Open biGdada opened this issue 3 years ago • 12 comments

hi. can this plugin play raw PCM audio (16 bit little endian, 44100, stereo)?

ffmpeg from command line can read this file with the following parameters: /usr/bin/ffmpeg -sample_rate 44100 -f s16le -ac 2

if it is possible, what #KODIPROP lines should be in strm file? thanks.

biGdada avatar Oct 29 '22 21:10 biGdada

Does kodi play this correctly from the strm file? I.e. with no KODIPROPS?

phunkyfish avatar Oct 30 '22 15:10 phunkyfish

i havent checked it with strm file, but it doesnt play when i choose it from the GUI. thats exactly the reason i'm trying to use ffmpegdirect do play it. AFAIK, kodis built-in player cant play raw pcm because the stream lacks the relevant headers. BUT, ffmpeg (the command line version) can read the file and convert it if i provide the command line parameters describing the format (-sample_rate 44100 -f s16le -ac 2). i was hoping there is a way to do the same with the plugin, considering the fact that it is based on ffmpeg.

biGdada avatar Oct 30 '22 17:10 biGdada

You should be able to pass arguments to ffmpeg using a | after the URL.

phunkyfish avatar Oct 31 '22 08:10 phunkyfish

its not a url, its a local file(a local pipe, to be exact) tried it, and this is the error i'm getting : ERROR <general>: AddOnLog: inputstream.ffmpegdirect: OpenWithCURL - error probing input format, /storage/.kodi/userdata/dockercdb/shairport-sync/tmp/shairport-sync-audio | -sample_rate 44100 -f s16le -ac 2 am i missing something?

biGdada avatar Oct 31 '22 18:10 biGdada

this is the contents of the strm file:

#KODIPROP:inputstream=inputstream.ffmpegdirect /storage/.kodi/userdata/dockercdb/shairport-sync/tmp/shairport-sync-audio | -sample_rate 44100 -f s16le -ac 2

biGdada avatar Oct 31 '22 18:10 biGdada

It still needs to be a URL so must follow URL syntax, so like:

#KODIPROP:inputstream=inputstream.ffmpegdirect 
/storage/.kodi/userdata/dockercdb/shairport-sync/tmp/shairport-sync-audio|sample_rate=44100&f=s16le&ac=2

Assuming these are valid ffmpeg options of course.

phunkyfish avatar Oct 31 '22 22:10 phunkyfish

I’m not saying this will work, but it is how you can pass ffmpeg options to the addon.

phunkyfish avatar Oct 31 '22 22:10 phunkyfish

it didnt work. is there a way to enable logging to see what parameters are being passed to ffmpeg?

biGdada avatar Nov 01 '22 00:11 biGdada

You can enable debug logging in Kodi and there is also an option to enable ffmpeg logging in the addon settings

All of the supported options are available here: https://ffmpeg.org/ffmpeg.html. I don’t see sample_rate though which is strange.

Is there a MIME type for audio stream? Maybe that would work.

phunkyfish avatar Nov 01 '22 08:11 phunkyfish

i've enabled debug logging and also ffmpeg logging in the addon but i cant see in the logs what are the exact parameters that are being passed to ffmpeg. i also tried to define the mime type, seems like its being ignored (mimetype=audio/wav;codec=pcm;rate=16000)

biGdada avatar Nov 02 '22 16:11 biGdada

As in:

#KODIPROP:mimetype=audio/wav;codec=pcm;rate=16000

phunkyfish avatar Nov 02 '22 19:11 phunkyfish

exactly. the .strm file: #KODIPROP:inputstream=inputstream.ffmpegdirect #KODIPROP:mimetype=audio/wav;codec=pcm;rate=16000 /storage/.kodi/userdata/dockercdb/shairport-sync/tmp/shairport-sync-audio

biGdada avatar Nov 02 '22 19:11 biGdada