Jump to content

OpenELEC playback freeze, okay when not using Emby


halfer

Recommended Posts

Kodi platform/version: Raspberry Pi 3/OpenELEC 6.95.3/Kodi 16.1

Emby platform/version: Ubuntu 16.04.1/Emby 3.0.8500.0

 

When streaming video from my Emby server using Direct Paths (SMB), my RPi3 will eventually "hang". Here's how it looks: the playback of video and audio will stop, and the application will seem to be frozen, so I won't be able to press "Stop" to stop the playback; it will be this way from 30s to a 1.5 minutes (didn't actually count the time); after which it will "unfreeze". The playback stops, I'm back at the main menu, all the functions I requested while in the freeze will activate at once, so if I pressed left/right back/enter, those keypresses will register all at once - this you can tell by the menu sounds going off multiple times at once. After that, the freezing will come at least once every 10 minutes, looking basically the same, until I reboot the Pi, and the issue will go away for some time.

 

Here are some things of note.

1.) It's actually the playback that's frozen, not the application itself, because, while frozen, the "enter" key on my remote is still functional: it will bring up the overlay menu, which I will be able to browse (pressing left/right to select play, fast forward, stop) but none of the functions will actually work. And external .srt subtitles will continue to work for some time, on top of the frozen footage (but will eventually freeze too); I didn't test .srt subtitles that are muxed into the file, though.

2.) Non-Emby playback has no issues. Just connecting to the source server using SMB and opening up my .mkv's manually results in no playback issues what so ever. I watched full movies like this without any freezes.

 

I synced the time on my Pi with my clock and tried to capture the exact time the freeze occured. The first time I was late by about 10 seconds, the second time by about 2, in any case, here are two extracts that seem to capture the first line logged around the time the freeze "unfroze", these lines are provided separately later. I am also providing the original log.

 

The freeze occured at approx. 01:12:53

01:06:55 2757.003906 T:1767895968  NOTICE: EMBY.kodimonitor -> Method: Player.OnPlay Data: {"item":{"id":1167,"type":"episode"},"player":{"playerid":1,"speed":1}}
01:06:55 2757.072021 T:1588024224  NOTICE: EMBY.websocket_client -> Message: {"MessageType":"UserUpdated","Data":{"Name":"Pavel","ServerId":"87f837e661c0405bb803a5f0b8f0e921","Id":"d678a5190ca348e38923a0b5d6d95c59","HasPassword":false,"HasConfiguredPassword":false,"HasConfiguredEasyPassword":false,"LastLoginDate":"2016-11-13T16:11:47.0385020Z","LastActivityDate":"2016-11-13T22:06:55.0908150Z","Configuration":{"AudioLanguagePreference":"eng","PlayDefaultAudioTrack":false,"SubtitleLanguagePreference":"","DisplayMissingEpisodes":false,"DisplayUnairedEpisodes":false,"GroupedFolders":[],"SubtitleMode":"None","DisplayCollectionsView":false,"EnableLocalPassword":false,"OrderedViews":[],"LatestItemsExcludes":[],"PlainFolderViews":[],"HidePlayedInLatest":true,"RememberAudioSelections":true,"RememberSubtitleSelections":true,"EnableNextEpisodeAutoPlay":true},"Policy":{"IsAdministrator":true,"IsHidden":false,"IsDisabled":false,"BlockedTags":[],"EnableUserPreferenceAccess":true,"AccessSchedules":[],"BlockUnratedItems":[],"EnableRemoteControlOfOtherUsers":true,"EnableSharedDeviceControl":true,"EnableLiveTvManagement":true,"EnableLiveTvAccess":true,"EnableMediaPlayback":true,"EnableAudioPlaybackTranscoding":true,"EnableVideoPlaybackTranscoding":true,"EnablePlaybackRemuxing":true,"EnableContentDeletion":false,"EnableContentDownloading":true,"EnableSync":true,"EnableSyncTranscoding":true,"EnabledDevices":[],"EnableAllDevices":true,"EnabledChannels":[],"EnableAllChannels":true,"EnabledFolders":[],"EnableAllFolders":true,"InvalidLoginAttemptCount":0,"EnablePublicSharing":true}}}
01:10:08 2950.949707 T:1767895968  NOTICE: EMBY.ga_client -> GA: {'cid': '7837a74be1a1b19fedfac7b8b619291c', 'sr': '1360x768', 'v': '1', 'ea': 'PlayPing', 'ec': 'PlayAction', 'an': 'Kodi4Emby', 'ul': 'Russian', 't': 'event', 'av': '2.3.6', 'tid': 'UA-85356267-1', 'aid': '1', 'ua': 'Kodi/16.1 (Linux Rpi)', 'ds': 'plugin'}
01:13:12 3134.039795 T:1294988192   ERROR: Read - Error( -1, 22, Invalid argument ) - Retrying
01:13:42 3164.047119 T:1294988192   ERROR: Read - Error( -1, 22, Invalid argument )
01:13:42 3164.047852 T:1294988192  NOTICE: CDVDPlayer::OnExit()
01:13:42 3164.047852 T:1294988192  NOTICE: DVDPlayer: eof, waiting for queues to empty
01:13:42 3164.047852 T:1294988192  NOTICE: Closing stream player 1
01:13:42 3164.047852 T:1294988192  NOTICE: CDVDMessageQueue(audio)::WaitUntilEmpty
01:13:42 3164.048096 T:1294988192  NOTICE: Waiting for audio thread to exit
01:13:42 3164.048096 T:1367339936  NOTICE: thread end: CDVDPlayerAudio::OnExit()
01:13:42 3164.048096 T:1294988192  NOTICE: Closing audio device
01:13:42 3164.048340 T:1294988192  NOTICE: Deleting audio codec
01:13:42 3164.048340 T:1294988192  NOTICE: Closing stream player 2
01:13:42 3164.048340 T:1294988192  NOTICE: CDVDMessageQueue(video)::WaitUntilEmpty
01:13:42 3164.055908 T:1294988192  NOTICE: waiting for video thread to exit
01:13:42 3164.055908 T:1397748640   ERROR: Got MSGQ_ABORT or MSGO_IS_ERROR return true
01:13:42 3164.055908 T:1397748640  NOTICE: thread end: video_thread
01:13:42 3164.056152 T:1294988192  NOTICE: deleting video codec
01:13:42 3164.059082 T:1294988192  NOTICE: Closing stream player 3
01:13:42 3164.147461 T:1963307008  NOTICE: CDVDPlayer::CloseFile()
01:13:42 3164.147461 T:1963307008  NOTICE: DVDPlayer: waiting for threads to exit
01:13:42 3164.147705 T:1963307008  NOTICE: DVDPlayer: finished waiting
01:13:42 3164.170654 T:1767895968  NOTICE: EMBY.player -> Played_information: {'smb://KODIBUNTU/6tb_HDD_root/TV2/X-Files/Season 7/the.x-files.s07e21.1080p.bluray.x264-rovers.mkv': {'paused': False, 'refresh_id': 'c2001244c8b181459f8d9b9d803190eb', 'AudioStreamIndex': 1, 'SubtitleStreamIndex': 2, 'currentPosition': 1528.31103515625, 'item_id': 'a0de9b6db4f3bf07d4f4d954b13a57dc', 'currentfile': 'smb://KODIBUNTU/6tb_HDD_root/TV2/X-Files/Season 7/the.x-files.s07e21.1080p.bluray.x264-rovers.mkv', 'runtime': 26831900000L, 'Type': 'Episode', 'playmethod': 'DirectPlay'}}

The freeze occured at approx. 01:15:37 (NOTE: it's almost 2 minutes after the initial freeze)

01:14:08 3190.122070 T:1515189152  NOTICE: EMBY.librarysync -> Updating emby database.
01:14:08 3190.429688 T:1515189152  NOTICE: EMBY.librarysync -> New sync time: client time -2 min: 2016-11-13T22:12:08Z
01:14:08 3190.629150 T:1515189152  NOTICE: EMBY.librarysync -> Commit successful.
01:14:08 3190.629639 T:1515189152  NOTICE: EMBY.librarysync -> Updating video library.
01:14:08 3190.708252 T:1429992352  NOTICE: VideoInfoScanner: Starting scan ..
01:14:08 3190.788818 T:1429992352  NOTICE: VideoInfoScanner: Finished scan. Scanning for video info took 00:00
01:14:08 3190.804199 T:1767895968  NOTICE: EMBY.kodimonitor -> Method: VideoLibrary.OnScanStarted Data: null
01:14:08 3190.805176 T:1767895968  NOTICE: EMBY.kodimonitor -> Method: VideoLibrary.OnScanFinished Data: null
01:15:09 3251.090332 T:1767895968  NOTICE: EMBY.ga_client -> GA: {'cid': '7837a74be1a1b19fedfac7b8b619291c', 'sr': '1360x768', 'v': '1', 'ea': 'PlayPing', 'ec': 'PlayAction', 'an': 'Kodi4Emby', 'ul': 'Russian', 't': 'event', 'av': '2.3.6', 'tid': 'UA-85356267-1', 'aid': '1', 'ua': 'Kodi/16.1 (Linux Rpi)', 'ds': 'plugin'}
01:15:59 3301.228760 T:1397748640   ERROR: Read - Error( -1, 22, Invalid argument ) - Retrying
01:16:29 3331.259277 T:1397748640   ERROR: Read - Error( -1, 22, Invalid argument )
01:16:29 3331.259521 T:1397748640  NOTICE: CDVDPlayer::OnExit()
01:16:29 3331.259521 T:1397748640  NOTICE: DVDPlayer: eof, waiting for queues to empty
01:16:29 3331.259521 T:1397748640  NOTICE: Closing stream player 1
01:16:29 3331.259766 T:1397748640  NOTICE: CDVDMessageQueue(audio)::WaitUntilEmpty
01:16:29 3331.259766 T:1397748640  NOTICE: Waiting for audio thread to exit
01:16:29 3331.259766 T:1258288032  NOTICE: thread end: CDVDPlayerAudio::OnExit()
01:16:29 3331.260010 T:1397748640  NOTICE: Closing audio device
01:16:29 3331.260010 T:1397748640  NOTICE: Deleting audio codec
01:16:29 3331.260254 T:1397748640  NOTICE: Closing stream player 2
01:16:29 3331.260254 T:1397748640  NOTICE: CDVDMessageQueue(video)::WaitUntilEmpty
01:16:29 3331.260742 T:1397748640  NOTICE: waiting for video thread to exit

Note these lines:

01:13:12 3134.039795 T:1294988192   ERROR: Read - Error( -1, 22, Invalid argument ) - Retrying
01:13:42 3164.047119 T:1294988192   ERROR: Read - Error( -1, 22, Invalid argument )
01:15:59 3301.228760 T:1397748640   ERROR: Read - Error( -1, 22, Invalid argument ) - Retrying
01:16:29 3331.259277 T:1397748640   ERROR: Read - Error( -1, 22, Invalid argument )

Just in case, all my videos are muxed in .mkv; encoded in h264, AC3/DTS; have .srt subtitles. My RPi is not over/underclocked, has no power issues. These problems don't occur on my Linux server running Emby and Kodi.

 

Thanks in advance!

kodi.log

Link to post
Share on other sites

Okay, so I narrowed down the problem a bit more, it seems it has something to do with SMB.

The Non-Emby playback I mentioned has no issues because it's not using SMB, it's using SFTP; and my Emby server has path substitution set up to do SMB (so that linux based and windows based Kodi clients can work).

How can I switch to SFTP, while having Windows Kodi clients also work?

 

EDIT: Okay, so now the issue is making Emby work with SFTP. Kodi supports SFTP, when given the credentials; Emby, however, with "Shared network folder" set to SFTP+port doesn't work. 

 

Example: My movie library has a folder set up like this:

 

Folder: /media/test/Movies

Shared network folder: sftp:/192.168.1.1:2222/media/test/Movies

 

When the Emby addon asks for the Network Credentials I write:

server name or adress: sftp:/192.168.1.1:2222

username: username

password: password

 

Checking passwords.xml afterwards, I see this:

<passwords>
  <path>
    <from pathversion="1">smb://sftp://192.168.1.1:2222/</from>
    <to pathversion="1">smb://username:password@sftp://192.168.1.1:2222/</to>
  </path>
</passwords>

So it automatically assumes I'm using SMB, great.

I tried changing it to what it's supposed to be, but no dice. Does Emby support sftp at all? I know it's primarily a Windows server, but what if? Because otherwise it means I'm basically screwed

Edited by halfer
Link to post
Share on other sites
Angelblue05

Maybe with using path substitution in Kodi? Since you are using direct paths, you can do from SMB://server to whatever you need.

 

 

Sent from my iPhone using Tapatalk

  • Like 1
Link to post
Share on other sites

Maybe with using path substitution in Kodi? Since you are using direct paths, you can do from SMB://server to whatever you need.

 

 

Sent from my iPhone using Tapatalk

I was using path substitution with SMB before, and it worked overall (but apparently resulted in those freezes I mentioned, Kodi has a problem with samba, it seems). But in the newer versions of Emby, it's recommended I drop path substitution and use "network share setup". 

fLMEYeS.png

 

That's what I did, and it's not working, no matter how I write the substitution. I even tried inserting the username and password there:

sftp://username:password@IP_ADDRESS_HERE:PORT_HERE

 

Still not working

 

EFCHJft.png

 

 

EDIT: Oh, you mean path substitution in Kody, not Emby; I apologize. I'll try

Edited by halfer
Link to post
Share on other sites

For the above screens, your path substitutions will still be used if they are present, so you would need to remove it with the trash can first.

Link to post
Share on other sites

For the above screens, your path substitutions will still be used if they are present, so you would need to remove it with the trash can first.

The path substitution pictured in the first image is a legacy connection that doesn't exist anymore and has no influence on the example pictured in the second image

Edited by halfer
Link to post
Share on other sites
Angelblue05

Yeah, if you do it in Emby, you'll need to resync your content to Kodi since you are using direct paths (to update the paths) or do a repair.

Edited by Angelblue05
Link to post
Share on other sites

So the problem isn't really fixed, but at least I have some understanding of what's actually going on.

1.) SMB implementation in Kodi is weird, and streaming from it causes freezes.

2.) Using SFTP instead of SMB in Emby's own library paths, when also using the Emby addon seems to be impossible. No matter how the final path is set in Emby, it won't work. I tried a substitute path that resulted in a correct path in Kodi (after resync, of course). Looked like this: sftp://IP_HERE:PORT_HERE/path_to_video.mkv. That doesn't work, even when the credentials are correctly set in passwords.xml. I also tried including the credentials in the path itself: sftp://username:password@IP_HERE:PORT_HERE/path_to_video.mkv. - that doesn't work either.

The only thing that seems to work for me at the moment is path subtitution in Kodi itself (as Angelblue05 suggested). Right now Emby's direct paths provide sftp://IP_HERE/path_to_video.mkv - and Kodi itself replaces sftp://IP_HERE with sftp://username:password@IP_HERE:PORT_HERE.

It works on my Linux clients (main server and RPi), but doesn't work on Windows (I guess SFTP on windows is faulty?). It can be fixed by making the Emby provided paths SMB (again, as Angelblue05 suggested), and not substituting in Kodi on Windows - but that would require another resync, and Windows isn't a priority right now, so screw it.

Still, it's strange that Emby's Network Credentials system doesn't seem to work sith SFTP, I tried every possible combination of passwords.xml and path subtitution in the addon; but, in the meantime, my current setup will do. Thanks for your help, I hope this will be helpful to somebody else, and maybe to Emby on Linux itself. Should I necro this thread in case I find something new related to this issue, or should I create a new one?

Edited by halfer
  • Like 1
Link to post
Share on other sites
  • 1 month later...

I decided to necro this thread, because I'm sure there's at least one poor fellow who has the same home server set up as me, and has the same issues.

After switching to the config mentioned in the previous post (path substitution in Kodi clients to change "sftp://IP_HERE"to "sftp://username:password@IP_HERE:PORT_HERE." I was still encountering issues: mainly, instead of freezing, the RPi was "buffering" when playing high bitrate videofiles - which was arguably as annoying as that I had before (but it didn't occur nearly as often).

So I switched to NFS. The speed is ridiculous compared to SMB (fast forwarding, skipping to the middle of a file - super fast), haven't had any issues yet. If you have a Linux server running Emby - share your media using NFS!

Link to post
Share on other sites
Guest
This topic is now closed to further replies.
×
×
  • Create New...