Jump to content

VirtualTV plugin


pünktchen

Recommended Posts

ringzer0
On 7/27/2021 at 8:19 PM, pünktchen said:

New version 0.9.9 in the starting post:

Export API:

  • Added option to override the host adress that is used to generate streaming urls
  • Added option to generate Kodi EmbyCon addon paths for streaming urls.
    This allows you to use either Continous or Playlist Playback mode in Kodi and fixes problems with non stopping streams that occured sometimes.
    A very big thank you to @TeamB who made this possible!

Channels:

  • Added seperate field to exclude seasons or episodes by tags from "Always include these named movies or tv shows"
  • Fixed channel rule evaluation for release date and runtime
  • Fixed bumpers where not recognized under certain situations

Thank punktchen!

One issue I'm having though. When viewing from an emby host I have no problem, but from kodi I get a timeout and the video never plays.  Looking at the logs I see this in the ffmpeg-VirtualTV0_***.txt file.

[http @ 0x1406180] HTTP error 505 HTTP Version Not Supported
[concat @ 0x13fc1c0] Impossible to open 'http://127.0.0.1:8096/emby/Videos/46964/stream.ts?StartTimeTicks=3281806705&Copytimestamps=false&VideoCodec=copy&AudioCodec=ac3&AudioStreamIndex=1&MediaSourceId=a18bfc8cab390326dadfcb93b8be814c&PlaySessionId=bb3c19d88403457b89443d142fa00b54&api_key=****'
/config/transcoding-temp/VirtualTV0_***.txt: Server returned 5XX Server Error reply

I can confirm that emby is listening on localhost. Do you have any idea what the cause of this issue is?

Link to comment
Share on other sites

pünktchen
25 minutes ago, ringzer0 said:

I can confirm that emby is listening on localhost. Do you have any idea what the cause of this issue is?

But does Kodi run on the same machine as Emby? Otherwise localhost doesn't make sense. Also i highly suggest the new EmbyCon option, provided you have that latest version installed in Kodi.

Link to comment
Share on other sites

hstamas
On 7/27/2021 at 9:19 PM, pünktchen said:

New version 0.9.9 in the starting post:

Export API:

  • Added option to generate Kodi EmbyCon addon paths for streaming urls.
    This allows you to use either Continous or Playlist Playback mode in Kodi and fixes problems with non stopping streams that occured sometimes.
    A very big thank you to @TeamB who made this possible!

 

Morning @pünktchen. Was wondering if you could explain how this works a bit more? What I am trying to achieve is being able to play VirtualTV live TV within Kodi but really havent played with Embycon all that much,.

My guess is you just select this option in your plugin and export the xml and m3u. Then you import it into Embycon in some way?

If this is more an Embycon question feel free to let me know.

Link to comment
Share on other sites

ringzer0
6 hours ago, pünktchen said:

But does Kodi run on the same machine as Emby? Otherwise localhost doesn't make sense. Also i highly suggest the new EmbyCon option, provided you have that latest version installed in Kodi.

Right it doesn't make sense, but that is the log from emby and not kodi. I see the request I expect come through for the stream, but then it sort of just stalls on ffmpeg and I get the above log from ffmpeg.

Quote

2021-07-29 13:53:44.610 Info Server: http/1.1 HEAD http://10.1.1.100:8096/emby/VirtualTV/Stream.mp4?ChannelId=256086&User=***&Pass=***&ConvertAudio=True&StopMode=log. UserAgent: Kodi/19.1 (X11; Linux armv7) Linux/2021.07-1 App_Bitness/32 Version/19.1
2021-07-29 13:53:44.616 Info Server: http/1.1 Response 200 to 10.1.1.101. Time: 6ms. http://10.1.1.100:8096/emby/VirtualTV/Stream.mp4?ChannelId=256086&User=***&Pass=***&ConvertAudio=True&StopMode=log
2021-07-29 13:53:44.621 Info Server: http/1.1 GET http://10.1.1.100:8096/emby/VirtualTV/Stream.mp4?ChannelId=256086&User=***&Pass=***&ConvertAudio=True&StopMode=log. UserAgent: Kodi/19.1 (X11; Linux armv7) Linux/2021.07-1 App_Bitness/32 Version/19.1
2021-07-29 13:53:44.625 Info LiveTvManager: Opening channel stream from VirtualTV, external channel Id: VirtualTV0
2021-07-29 13:53:45.230 Info VirtualTV Plugin: FFmpegConcatDemuxer > ffmpeg command: -nostdin -threads 1 -y -f concat -safe 0 -protocol_whitelist file,http,tcp -probesize 100M -analyzeduration 100M -err_detect +ignore_err -fflags +genpts -start_at_zero -re -i "/config/transcoding-temp/VirtualTV0_***.txt" -ignore_unknown -map 0:0 -map 0:1 -c:V copy -bsf:v h264_mp4toannexb -af aresample=async=1 -movflags +empty_moov+delay_moov -hls_segment_type fmp4 -hls_flags +single_file "/config/transcoding-temp/VirtualTV0_***.mp4"
2021-07-29 13:53:45.230 Info VirtualTV Plugin: FFmpegConcatDemuxer > VideoList: /config/transcoding-temp/VirtualTV0_***.txt, DemuxedFile: /config/transcoding-temp/VirtualTV0_***.mp4, StartOffset: 15 minutes

I have been using emby next-gen, but I will grab embycon and see if that fixes anything.

Link to comment
Share on other sites

Spaceboy

hi, i have one channel set up that includes music videos selected by genre from my music video library. the videos tend to be on average 5mins in length.

while the channel plays fine on ios and in the web client (not on ATV but i will take that up separately there when this is resolved), the video that plays back is not what i expect as shown in the epg generated. All other channels i have work fine, so i can only assume this is to do with the length of the video, perhaps some sort of rounding errors in terms of calculating the runtimes?

i have tried looking through the epg to see if i can find the playing video in future "programs" but i don't see it.

what further information can i provide to help work this one out?

Link to comment
Share on other sites

pünktchen

@ringzer0 I've looked again at your log snippets and this is outstanding:

[http @ 0x1406180] HTTP error 505 HTTP Version Not Supported

"The HyperText Transfer Protocol (HTTP) error 505 : HTTP Version Not Supported response status code indicates that the HTTP version used in the request is not supported by the server." In other words the default http version that is used by your ffmpeg version is higher than the one that your Emby server accept. I don't know how this can happen other than with a bad configured reverse proxy in front of Emby even for localhost. It's nothing my plugin can fix. It will always happen for you in Kodi and also Emby apps as long as the "Continous Playback" mode with the help of ffmpeg is involved. But never mind, with EmbyCon in Kodi you can use "Playlist" as playback mode which works completely different.

Link to comment
Share on other sites

pünktchen

@ringzer0 @hstamas Instructions for VirtualTV and EmbyCon:

You have to install either the Emby beta repo in Kodi and use the latest EmbyCon addon or just take this one for Matrix: 
In the EmbyCon addon set your Emby connection details and an Emby user.
Make sure in the EmbyCon addon settings under Services, Enable Emby remote control is active!
Disable the Play Next and On Playback Stop Events in the addon.

In the Emby VirtualTV plugin under the Export Options, set an export folder path and activate EmbyCon addon paths for streaming urls.
Run Export VirtualTV Channels & Program under Emby Scheduled Tasks.
Use the generated channels.m3u and guide.xml file in Kodi's SimplePVR addon.
Alternatively you can also use the direct links in the SimplePVR addon:

Channels:
http://{Hostadress}:{Port}/emby/VirtualTV/Channels?User={SomeName}&UseEmbyCon=true

Guide:
http://{Hostadress}:{Port}/emby/VirtualTV/Guide

 
In Kodi Matrix there's currently a bug that makes starting videos very slow. As a workaround, create an advancedsettings.xml file in Kodi's userdata folder:

<advancedsettings>
    <network>
        <curlclienttimeout>2</curlclienttimeout>
        <curlretries>0</curlretries>
    </network>
</advancedsettings>


For playback i highly suggest to set "Playlist" as playback mode for the VirtualTV channels.
For a nice integration in Kodi you should then create a custom keyboard.xml under Kodi's userdata\keymaps folder:

<keymap>
  <FullscreenVideo>
    <keyboard>
      <c>ActivateWindow(TVGuide)</c>
      <menu>ActivateWindow(TVGuide)</menu>
    </keyboard>
    <remote>
      <menu>ActivateWindow(TVGuide)</menu>
    </remote>
  </FullscreenVideo>
</keymap>

 

Edited by pünktchen
removed attachement
  • Thanks 1
Link to comment
Share on other sites

pünktchen

@Spaceboy I don't think there's a problem with rounding the start and end times. You will only notice this after watching maybe 50 videos in row,
but the very first video is always exactly what you see in the guide. The id of the videos to play is stored within the program details, so i have no idea what happens on your side. I have tested it here with the three short music videos i have and it all plays nicely. Did you make changes to your music library after the guide refresh?

Link to comment
Share on other sites

Spaceboy
10 hours ago, pünktchen said:

@Spaceboy I don't think there's a problem with rounding the start and end times. You will only notice this after watching maybe 50 videos in row,
but the very first video is always exactly what you see in the guide. The id of the videos to play is stored within the program details, so i have no idea what happens on your side. I have tested it here with the three short music videos i have and it all plays nicely. Did you make changes to your music library after the guide refresh?

no changes made to music library after guide refresh, nope.

when testing yesterday and today i do notice its only 7 mins out. As in what plays when i hit play on the channel (and is shown on the OSD in playback) is on in c7mins time according to the epg. epg refresh took place 8 hours ago so in that time there could have been 90-120 "programs". i agree rounding seems unlikely as if we take a middle estimate of 100 programs that means that each video length was wrong on average by 4.2 seconds.

let me know if i can provide any further info or happy to provide you with a login so you can see for yourself

 

Link to comment
Share on other sites

Spaceboy

good question which i should have checked. no, even immediately after a guide refresh the video that plays back is the one after the one shown in the epg. c 3mins out

Link to comment
Share on other sites

pünktchen

That would be okay if there's a value greater than null for the start offset under playback options. Although i probably better disable that completely for music videos in the future.

  • Thanks 1
Link to comment
Share on other sites

Spaceboy
2 hours ago, pünktchen said:

That would be okay if there's a value greater than null for the start offset under playback options. Although i probably better disable that completely for music videos in the future.

yep! that was it. if i set that to zero it runs to the epg. so yes please. i would like to use that start offset on non-music video channels but have it disabled on music video channels if possible

Link to comment
Share on other sites

pünktchen

Last test for the moment: start that channel some hours after the guide refresh, but this time with "Continous (Live)" playback mode.

Link to comment
Share on other sites

ringzer0
On 7/29/2021 at 5:07 PM, pünktchen said:

@ringzer0 I've looked again at your log snippets and this is outstanding:




[http @ 0x1406180] HTTP error 505 HTTP Version Not Supported

"The HyperText Transfer Protocol (HTTP) error 505 : HTTP Version Not Supported response status code indicates that the HTTP version used in the request is not supported by the server." In other words the default http version that is used by your ffmpeg version is higher than the one that your Emby server accept. I don't know how this can happen other than with a bad configured reverse proxy in front of Emby even for localhost. It's nothing my plugin can fix. It will always happen for you in Kodi and also Emby apps as long as the "Continous Playback" mode with the help of ffmpeg is involved. But never mind, with EmbyCon in Kodi you can use "Playlist" as playback mode which works completely different.

Thanks for your help punktchen.

This was bugging me since it made no sense whatsoever, so I spent some time debugging. Turns out when I copied my API key there was a space at the end (when I bleeped out my API key I also deleted the space by accident). Anyway that space at the end was breaking the whole request and causing the 500 error.

One of the last things I would have guessed

Edited by ringzer0
  • Like 1
Link to comment
Share on other sites

Spaceboy
On 30/07/2021 at 22:44, pünktchen said:

Last test for the moment: start that channel some hours after the guide refresh, but this time with "Continous (Live)" playback mode.

that works fine too

Link to comment
Share on other sites

Mookdog

How do I find my api keys in emby server 4.6 ? I see the listing that said api key and I created one but it wont let me copy and paste into VirtualTV

Link to comment
Share on other sites

Mookdog
18 hours ago, Svennie said:

Mark the API key, copy with ctrl + c and paste with ctrl + v

Thanks I should have known that I have only been using pc for over 30 years lol

 

Mook

Link to comment
Share on other sites

hstamas
12 hours ago, Mookdog said:

Can anyone explain to me what the different playback method for channels do ?

Thanks

Mook

I'll take a stab at it!

Playlist = Direct playback bypassing the live TV engine all together. Playback is fast and instant with no transcoding (unless its needed in a normal Emby situation). Emby is aware of the currently playing show.

Continuous Playback (Live) = Plays via the live TV engine. Bigger chance of transcoding unless you have all optimized files. Playback, when initiated starts at the reported guide timeline (ie: if the guide says the show is already 15 minutes in it will start playback at that point).

Continuous Playback (Archive): Same as Live but will start playback at the beginning of the show always.

I use Playlist mode exclusively as my server cant keep up with the transcoding so I really cant tell you any other advantages/disadvatages one over the other.

Please feel free to chime in if any of the above is not correct.

Edited by hstamas
  • Like 1
Link to comment
Share on other sites

Mookdog
8 hours ago, hstamas said:

I'll take a stab at it!

Playlist = Direct playback bypassing the live TV engine all together. Playback is fast and instant with no transcoding (unless its needed in a normal Emby situation). Emby is aware of the currently playing show.

Continuous Playback (Live) = Plays via the live TV engine. Bigger chance of transcoding unless you have all optimized files. Playback, when initiated starts at the reported guide timeline (ie: if the guide says the show is already 15 minutes in it will start playback at that point).

Continuous Playback (Archive): Same as Live but will start playback at the beginning of the show always.

I use Playlist mode exclusively as my server cant keep up with the transcoding so I really cant tell you any other advantages/disadvatages one over the other.

Please feel free to chime in if any of the above is not correct.

Thanks that helps alot. I am leaving it on playlist. My PC can transcode but why use up resources when its really not necessary lol

Mook

Link to comment
Share on other sites

Mookdog

I noticed a bit of a problem I am having. On Emby for Android TV. The guide doesnt populate the EPG completely the 1st 6 channels come up with no data. If I switch to the Emby app for just android it works perfect. Is there a bug causing this problem on the Android TV app ?

 

Mook

  • Agree 1
Link to comment
Share on other sites

GrimReaper
14 hours ago, Mookdog said:

I noticed a bit of a problem I am having. On Emby for Android TV. The guide doesnt populate the EPG completely the 1st 6 channels come up with no data. If I switch to the Emby app for just android it works perfect. Is there a bug causing this problem on the Android TV app ?

 

Mook

Yes, I can second this: on Android TV App, I'm getting all the sections: On Now, Programs, Upcoming, Channels etc., inside Channel list is also present, but the Guide ain't populating. Vanilla Android App or Web App have no such issue. 

 

Emby3.png

Emby5.png

Emby6.png

Emby8.png

Emby1.png

Screenshot 2021-08-05 071734.png

Screenshot 2021-08-05 071803.png

 

Edit: OK, further findings: in my case it is tied to disconnected nature, i.e. if system was Offline during Guide refreshing, it will not show in Android TV app. If it was Online, it will. Subsequently, if going Offline again, it will still show it - until new Guide refresh is undertaken while Offline, in which case it will not show again. Don't quite understand why, as VirtualTV is the only Guide actually created and it is all local, nothing is pulled from the web. Curious enough, neither Android App, Web App or Theater UWP exhibit same behavior, they are all displaying Guide regardless of when was it created. 

Edit2: Found the issue: Android TV client defaulted to December 31, 2008 upon reboot while Offline. No wonder there's no Guide data. 🤷‍♂️

@Mookdog, do check Date & Time on your TV/Android box. 

Edited by GrimReaper76
Typo/Append/Findings
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...