Jump to content


Photo

Dynamic folder content in channel plugin


  • Please log in to reply
27 replies to this topic

#21 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 142515 posts
  • Local time: 12:38 PM

Posted 23 November 2019 - 06:20 PM

It's not currently possible, although it's a good idea and something that can be added at some point.



#22 ZR1000A1 OFFLINE  

ZR1000A1

    Member

  • Members
  • 15 posts
  • Local time: 12:38 PM

Posted 24 November 2019 - 01:23 PM

Thanks!

 

One more (hope the last :)) question.

It takes Web Browser client a very long time (over a minute!) to open a stream. Android client does not open it at all - no errors, just keeps spinning (and the only way to stop it is by killing the process). Roku client on the other hand opens the same stream almost instantly - 5 sec.

Is there any way for the plugin to make a Web Browser client to open the stream faster (maybe some ChannelItemInfo or MediaSourceInfo parameters)?

Also would be nice to make it work on Android, but I see that IPTV channel does not work on Android as well, so I assume, it's a generic issue with the client.

 

Thanks again!


Edited by ZR1000A1, 24 November 2019 - 01:24 PM.


#23 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 142515 posts
  • Local time: 12:38 PM

Posted 24 November 2019 - 01:27 PM

We 'd have to go over an example. Thanks.



#24 ZR1000A1 OFFLINE  

ZR1000A1

    Member

  • Members
  • 15 posts
  • Local time: 12:38 PM

Posted 25 November 2019 - 10:22 AM

The steam the channel plays is HTTP Live Streaming Playlist (https://developer.ap...ow_construction) .M3U8 URL and looks like:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PROGRAM-DATE-TIME:2019-11-24T21:04:01.799Z
#EXT-X-KEY:METHOD=AES-128,URI="https://***.com/.....",IV=0xXXXXXXXXXXXXX
#EXTINF:5.005,
21/04/01.ts
#EXTINF:5.005,
21/04/06.ts
#EXTINF:5.005,
21/04/11.ts
#EXTINF:5.005,
21/04/16.ts
#EXTINF:5.005,
21/04/21.ts
#EXTINF:5.005,
21/04/26.ts
#EXTINF:5.005,
21/04/31.ts
#EXT-X-KEY:METHOD=AES-128,URI="https://***.com/.....",IV=0xXXXXXXXXXXXXX
#EXTINF:5.005,
21/04/36.ts
#EXTINF:5.005,
21/04/41.ts
#EXTINF:5.005,

The channel creates MediaSourceInfo like:

public async Task<IEnumerable<MediaSourceInfo>> GetChannelItemMediaInfo(string id, CancellationToken cancellationToken)
{
    ......

    return new List<MediaSourceInfo>
    {
        new MediaSourceInfo
        {
            Path = <M3U8 URL>,
            Protocol = MediaProtocol.Http,
            Name = id,
            Id = id
        }
    };
}

The result is:

 

Roku and Emby Theater (trial) - start playing fast (5 - 10 sec)

Chrome, Firefox - start playing extremely slow (over 1 minute)

Microsoft Edge and Android client - never start playing, keep spinning and spinning

 

Any suggestions on how to improve MediaSourceInfo so streams start playing faster and work on Android client?

 

Update:

This is a debug log when a stream is opened in Firefox (see 1'06" delay?):

 

>>> MediaSourceInfo returned <<<
2019-11-25 09:37:00.692 Debug MyChannel: [MyChannel][GetChannelItemMediaInfo] Starts playing: https://***.com/***.m3u8
2019-11-25 09:37:00.726 Info App: User policy for ****. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
2019-11-25 09:37:00.747 Info HttpServer: HTTP Response 200 to ::1. Time: 633ms. http://localhost:809...trate=140000000

>>> 1 minute 6 seconds DELAY!!! <<<
2019-11-25 09:38:06.918 Info HttpServer: HTTP POST http://localhost:809...essions/Playing. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0
2019-11-25 09:38:06.956 Info SessionManager: Playback start reported by app Emby Web 4.3.0.26 playing 720p 60fps. Started at 0 ms
2019-11-25 09:38:06.958 Info HttpServer: HTTP Response 204 to ::1. Time: 40ms. http://localhost:809...essions/Playing
2019-11-25 09:38:06.960 Debug XmlSerializer: Deserializing file C:\Users\ifurman\AppData\Roaming\Emby-Server\programdata\config\webhooks.xml
2019-11-25 09:38:06.965 Debug XmlSerializer: Deserializing file C:\Users\ifurman\AppData\Roaming\Emby-Server\programdata\config\notifications.xml
2019-11-25 09:38:07.082 Info HttpServer: HTTP POST http://localhost:809...trate=140000000. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0
2019-11-25 09:38:07.084 Debug App: GetPostedPlaybackInfo request: {"Id":"66658","UserId":"fcab20cefd4b4f00a0ccfedcd033d89b","MaxStreamingBitrate":140000000,"StartTimeTicks":0,"MediaSourceId":"20191124|2019020362|70052703_MSG-B|720p_60fps","DeviceProfile":{"EnableAlbumArtInDidl":false,"EnableSingleAlbumArtLimit":false,"EnableSingleSubtitleLimit":false,"SupportedMediaTypes":"Audio,Photo,Video","MaxAlbumArtWidth":0,"MaxAlbumArtHeight":0,"MaxStreamingBitrate":140000000,"MusicStreamingTranscodingBitrate":192000,"TimelineOffsetSeconds":0,"RequiresPlainVideoItems":false,"RequiresPlainFolders":false,"IgnoreTranscodeByteRangeRequests":false,"XmlRootAttributes":[],"DirectPlayProfiles":[{"Container":"mp4,m4v","AudioCodec":"aac,opus,flac,vorbis","VideoCodec":"h264,vp8,vp9","Type":"Video"},{"Container":"flv","AudioCodec":"aac,mp3","VideoCodec":"h264","Type":"Video"},{"Container":"opus","Type":"Audio"},{"Container":"mp3","AudioCodec":"mp3","Type":"Audio"},{"Container":"mp2,mp3","AudioCodec":"mp2","Type":"Audio"},{"Container":"m4a","AudioCodec":"aac","Type":"Audio"},{"Container":"flac","Type":"Audio"},{"Container":"webma,webm","Type":"Audio"},{"Container":"wav","Type":"Audio"},{"Container":"ogg","Type":"Audio"},{"Container":"webm","AudioCodec":"vorbis,opus","VideoCodec":"VP8","Type":"Video"},{"Container":"webm","AudioCodec":"vorbis,opus","VideoCodec":"VP9","Type":"Video"}],"TranscodingProfiles":[{"Container":"aac","Type":"Audio","AudioCodec":"aac","Protocol":"hls","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Streaming","MaxAudioChannels":"2","MinSegments":1,"SegmentLength":0,"BreakOnNonKeyFrames":true},{"Container":"aac","Type":"Audio","AudioCodec":"aac","Protocol":"http","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Streaming","MaxAudioChannels":"2","MinSegments":0,"SegmentLength":0,"BreakOnNonKeyFrames":false},{"Container":"mp3","Type":"Audio","AudioCodec":"mp3","Protocol":"http","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Streaming","MaxAudioChannels":"2","MinSegments":0,"SegmentLength":0,"BreakOnNonKeyFrames":false},{"Container":"opus","Type":"Audio","AudioCodec":"opus","Protocol":"http","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Streaming","MaxAudioChannels":"2","MinSegments":0,"SegmentLength":0,"BreakOnNonKeyFrames":false},{"Container":"wav","Type":"Audio","AudioCodec":"wav","Protocol":"http","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Streaming","MaxAudioChannels":"2","MinSegments":0,"SegmentLength":0,"BreakOnNonKeyFrames":false},{"Container":"opus","Type":"Audio","AudioCodec":"opus","Protocol":"http","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Static","MaxAudioChannels":"2","MinSegments":0,"SegmentLength":0,"BreakOnNonKeyFrames":false},{"Container":"mp3","Type":"Audio","AudioCodec":"mp3","Protocol":"http","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Static","MaxAudioChannels":"2","MinSegments":0,"SegmentLength":0,"BreakOnNonKeyFrames":false},{"Container":"aac","Type":"Audio","AudioCodec":"aac","Protocol":"http","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Static","MaxAudioChannels":"2","MinSegments":0,"SegmentLength":0,"BreakOnNonKeyFrames":false},{"Container":"wav","Type":"Audio","AudioCodec":"wav","Protocol":"http","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Static","MaxAudioChannels":"2","MinSegments":0,"SegmentLength":0,"BreakOnNonKeyFrames":false},{"Container":"ts","Type":"Video","VideoCodec":"h264","AudioCodec":"aac","Protocol":"hls","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Streaming","MaxAudioChannels":"2","MinSegments":1,"SegmentLength":0,"BreakOnNonKeyFrames":true,"ManifestSubtitles":"vtt"},{"Container":"webm","Type":"Video","VideoCodec":"vpx","AudioCodec":"vorbis","Protocol":"http","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Streaming","MaxAudioChannels":"2","MinSegments":0,"SegmentLength":0,"BreakOnNonKeyFrames":false},{"Container":"mp4","Type":"Video","VideoCodec":"h264","AudioCodec":"aac,opus,flac,vorbis","Protocol":"http","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Static","MinSegments":0,"SegmentLength":0,"BreakOnNonKeyFrames":false}],"ContainerProfiles":[],"CodecProfiles":[{"Type":"VideoAudio","Conditions":[{"Condition":"Equals","Property":"IsSecondaryAudio","Value":"false","IsRequired":false}],"ApplyConditions":[],"Codec":"aac"},{"Type":"VideoAudio","Conditions":[{"Condition":"Equals","Property":"IsSecondaryAudio","Value":"false","IsRequired":false}],"ApplyConditions":[]},{"Type":"Video","Conditions":[{"Condition":"EqualsAny","Property":"VideoProfile","Value":"high|main|baseline|constrained baseline","IsRequired":false},{"Condition":"LessThanEqual","Property":"VideoLevel","Value":"51","IsRequired":false}],"ApplyConditions":[],"Codec":"h264"}],"ResponseProfiles":[{"Container":"m4v","Type":"Video","MimeType":"video/mp4","Conditions":[]}],"SubtitleProfiles":[{"Format":"vtt","Method":"Hls"},{"Format":"vtt","Method":"External"},{"Format":"ass","Method":"External"},{"Format":"ssa","Method":"External"}]},"EnableDirectPlay":false,"EnableDirectStream":false,"EnableTranscoding":true,"AllowVideoStreamCopy":true,"AllowAudioStreamCopy":true,"IsPlayback":true,"AutoOpenLiveStream":true,"DirectPlayProtocols":["Http"]}
2019-11-25 09:38:07.086 Info App: User policy for ***. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
2019-11-25 09:38:07.086 Info HttpServer: HTTP Response 200 to ::1. Time: 4ms. http://localhost:809...trate=140000000
2019-11-25 09:38:07.103 Info HttpServer: HTTP GET http://localhost:809...erNotSupported.Host=localhost:8096, User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0, Accept=*/*, Accept-Language=en-US,en;q=0.5, Accept-Encoding=gzip, deflate, Connection=keep-alive, Referer=http://localhost:8096/web/index.html, DNT=1
2019-11-25 09:38:07.110 Debug App: Master playlist:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-STREAM-INF:BANDWIDTH=168000000,AVERAGE-BANDWIDTH=140000000,VIDEO-RANGE=SDR,CODECS="avc1.640029,mp4a.40.2"
live.m3u8?DeviceId=TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NDsgcnY6NzAuMCkgR2Vja28vMjAxMDAxMDEgRmlyZWZveC83MC4wfDE1NzM2MDc0Njg4MDE1&MediaSourceId=20191124|2019020362|70052703_MSG-B|720p_60fps&PlaySessionId=faabe12e1c7d4c04b7e439500e4bfbcd&api_key=71e1dd4e2d4b4e1789f9428f81988486&VideoCodec=h264&AudioCodec=aac&VideoBitrate=139808000&AudioBitrate=192000&TranscodingMaxAudioChannels=2&SegmentContainer=ts&MinSegments=1&BreakOnNonKeyFrames=True&ManifestSubtitles=vtt&h264-profile=high,main,baseline,constrainedbaseline&h264-level=51&TranscodeReasons=ContainerNotSupported

2019-11-25 09:38:07.111 Info HttpServer: HTTP Response 200 to ::1. Time: 8ms. http://localhost:809...nerNotSupported
2019-11-25 09:38:07.123 Info HttpServer: HTTP GET http://localhost:809...erNotSupported.Host=localhost:8096, User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0, Accept=*/*, Accept-Language=en-US,en;q=0.5, Accept-Encoding=gzip, deflate, Connection=keep-alive, Referer=http://localhost:8096/web/index.html, DNT=1
2019-11-25 09:38:07.128 Debug App: CodecValidation: FindVideoEncoder - Media: h264, UseHardwareCodecs: True, Mode: Automatic
2019-11-25 09:38:07.133 Debug App: CodecValidation: FindVideoEncoder - Checking: 'libx264 Software Encoder' (Priority: 0)
2019-11-25 09:38:07.133 Debug App: CodecValidation: Encoder supports input stream
2019-11-25 09:38:07.133 Debug App: CodecValidation: FindVideoEncoder - Check successful - selecting 'libx264 Software Encoder'
2019-11-25 09:38:07.154 Info App: ProcessRun 'StreamTranscode 415471' Execute: C:\Users\ifurman\AppData\Roaming\Emby-Server\system\ffmpeg.exe -loglevel +timing -i "https://***.com/***.m3u8"-map_metadata -1 -map_chapters -1 -threads 0 -sn -c:v:0 libx264 -pix_fmt yuv420p  -maxrate 139808000 -bufsize 279616000 -preset veryfast -profile:v:0 high -level:v:0 4.1 -crf 23 -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames "expr:if(isnan(prev_forced_t),eq(t,t),gte(t,prev_forced_t+3))" -vsync -1 -codec:a:0 aac -disposition:a:0 default -ac:a:0 2 -ab:a:0 192000  -f segment -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -segment_time 3  -individual_header_trailer 0 -segment_format mpegts -segment_write_temp 1 -segment_list_entry_prefix "hls/4424e592e4f270758209ba6ed5fbac0a/" -segment_list_type m3u8 -segment_start_number 0 -segment_list "C:\Users\ifurman\AppData\Roaming\Emby-Server\programdata\transcoding-temp\4424e592e4f270758209ba6ed5fbac0a.m3u8" -y "C:\Users\ifurman\AppData\Roaming\Emby-Server\programdata\transcoding-temp\4424e592e4f270758209ba6ed5fbac0a%d.ts"
2019-11-25 09:38:07.162 Debug App: ProcessRun 'StreamTranscode 415471' Started.
2019-11-25 09:38:10.259 Debug App: Waiting for 1 segments in C:\Users\ifurman\AppData\Roaming\Emby-Server\programdata\transcoding-temp\4424e592e4f270758209ba6ed5fbac0a.m3u8
2019-11-25 09:38:10.266 Debug App: Finished waiting for 1 segments in C:\Users\ifurman\AppData\Roaming\Emby-Server\programdata\transcoding-temp\4424e592e4f270758209ba6ed5fbac0a.m3u8
2019-11-25 09:38:10.275 Info HttpServer: HTTP Response 200 to ::1. Time: 3151ms. http://localhost:809...nerNotSupported
2019-11-25 09:38:10.289 Info HttpServer: HTTP GET http://localhost:809...a6ed5fbac0a0.ts. Host=localhost:8096, User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0, Accept=*/*, Accept-Language=en-US,en;q=0.5, Accept-Encoding=gzip, deflate, Connection=keep-alive, Referer=http://localhost:8096/web/index.html, DNT=1
2019-11-25 09:38:10.308 Info HttpServer: HTTP Response 200 to ::1. Time: 19ms. http://localhost:809...a6ed5fbac0a0.ts
2019-11-25 09:38:10.597 Info HttpServer: HTTP POST http://localhost:809...laying/Progress. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0
2019-11-25 09:38:10.640 Info HttpServer: HTTP Response 204 to ::1. Time: 43ms. http://localhost:809...laying/Progress
 


Edited by ZR1000A1, 25 November 2019 - 10:54 AM.


#25 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 142515 posts
  • Local time: 12:38 PM

Posted 25 November 2019 - 02:45 PM

and the complete log file?



#26 ZR1000A1 OFFLINE  

ZR1000A1

    Member

  • Members
  • 15 posts
  • Local time: 12:38 PM

Posted 25 November 2019 - 03:11 PM

and the complete log file?

 

Here it is.


Edited by ZR1000A1, 28 November 2019 - 01:02 PM.


#27 ZR1000A1 OFFLINE  

ZR1000A1

    Member

  • Members
  • 15 posts
  • Local time: 12:38 PM

Posted 28 November 2019 - 11:03 AM

Another issue. Playing streams in EmbyCon (Emby plugin for Kodi) fails in ffmpeg. The reason is that EmbyCon does not set SegmentContainer param in play url. That causes the Emby server generate invalid FFmpeg arguments list (empty -segment_format argument). Could be fixed 2 ways:

1. EmbyCon must set SegmentContainer in URL (that's how I fixed it locally)

2. Server should not add -segment_format argument to ffmpeg.exe if SegmentContainer is missing (probably, the right fix)

 

Also, I'm pleased to say that my plugin now works in Android client! I did 2 things:

1. Updated the server

2. As Luke suggested, replaced separator char in ItemID's with '_' (it was '|')

 

One of these fixed Android playback.

 

Thanks



#28 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 142515 posts
  • Local time: 12:38 PM

Posted 28 November 2019 - 11:05 AM

Thanks for the info.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users