xbmc / inputstream.ffmpegdirect

Supports streams opened by FFmpeg's libavformat or Kodi's cURL such as plain TS, HLS and DASH (non-DRM) as well as many others. There is support for Archive/Catchup services where there is a replay window and can timeshift across that span. Also provides timeshift for live streams where rewind/pause and fast-forward would not have been available.
GNU General Public License v2.0
58 stars 42 forks source link

[HELP] playing raw PCM audio #205

Open biGdada opened 1 year ago

biGdada commented 1 year ago

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.

phunkyfish commented 1 year ago

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

biGdada commented 1 year ago

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.

phunkyfish commented 1 year ago

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

biGdada commented 1 year ago

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 commented 1 year ago

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

phunkyfish commented 1 year ago

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 commented 1 year ago

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

biGdada commented 1 year ago

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

phunkyfish commented 1 year ago

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.

biGdada commented 1 year ago

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)

phunkyfish commented 1 year ago

As in:

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

biGdada commented 1 year ago

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