Problems with streaming http hosted mkv's - Failed to write chunk to file

Hi,

I finished creating my channel, “everything” besides the actual playing works.

When I am in the middle of a stream, I constatly get

Player: Excessive buffering detected; network
Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING
Failed to load resource: the server responded with a status of 400 (Bad Request)
Media element error code: 2

In the console log of the Plex webinterface.

Oct 23, 2015 10:01:02 [0x7f0aec3ff700] DEBUG - Request: [127.0.0.1:55985] PUT /video/:/transcode/session/mmmt5izo9qus1yvi/progress?progress=49.3&size=1177194059&remaining=9110 (7 live)
Oct 23, 2015 10:01:02 [0x7f0aec3ff700] VERBOSE -  * progress => 49.3
Oct 23, 2015 10:01:02 [0x7f0aec3ff700] VERBOSE -  * size => 1177194059
Oct 23, 2015 10:01:02 [0x7f0aec3ff700] VERBOSE -  * remaining => 9110
Oct 23, 2015 10:01:02 [0x7f0aec3ff700] VERBOSE - doShouldThrottleTranscodeNow: m_lastChunkWritten = 279, m_lastChunkRead = 248, chunksToThrottle = 32 (session: mmmt5izo9qus1yvi)
Oct 23, 2015 10:01:02 [0x7f0aec3ff700] DEBUG - It took 0.0 sec to serialize a list with 0 elements.
Oct 23, 2015 10:01:02 [0x7f0af77fe700] DEBUG - Completed: [127.0.0.1:55985] PUT /video/:/transcode/session/mmmt5izo9qus1yvi/progress?progress=49.3&size=1177194059&remaining=9110 (7 live) 0ms 289 bytes 206
Oct 23, 2015 10:01:02 [0x7f0aeabfe700] DEBUG - [Transcoder] Throttle - Getting back to work.
Oct 23, 2015 10:01:02 [0x7f0aee3ff700] ERROR - Failed to write chunk to file /tmp/plex-transcode-mmmt5izo9qus1yvi-3fdca1b3-b66c-4d17-a971-1a42cca4eaa2/chunk-temp
Oct 23, 2015 10:01:02 [0x7f0aee3ff700] ERROR - Failed to write chunk to file /tmp/plex-transcode-mmmt5izo9qus1yvi-3fdca1b3-b66c-4d17-a971-1a42cca4eaa2/chunk-temp
Oct 23, 2015 10:01:02 [0x7f0aee3ff700] ERROR - Failed to write chunk to file 

If I tail the media-server log, I can see when the transcoder fails. 60 seconds later the video playback stops.

Where do I start debugging? :confused:

You could try on a different plex client to see if the same thing happens. Then you know it’s likely the servers fault.

Check if your server can transcode other media. Play a movie or something in the web client and lower the bitrate on the player.

Make sure you are creating the media object with the correct values, it might effect the transcoder (protocol, video_code, audio_codec, audio_channels, video_resolution, container…) see page 64 of the PlexPlug-inFramework.pdf

It happens on Chromecast and in the Browser, as well as on Windows Server and on Debian Server.

Here’s a pastebin of a failing transcode on Windows.
http://pastebin.com/6RcgBXcc

I set the maximum duration to 5 hours intentionally in hope it would get better.
I think this are the relevevant sections:

Some chunks befor the end (timeline: stopped, 2467559/18000000)

Oct 25, 2015 02:32:23:241 [2936] DEBUG - [TranscodeOutputStream] Input processing thread exited after writing 1000731960 bytes, m_closed=0, m_endOfFileReached=1, session->isStopped()=0

Oct 25, 2015 02:32:49:999 [4596] DEBUG - [TranscodeOutputStream] Reached end of file
Oct 25, 2015 02:32:49:999 [4596] VERBOSE - [TranscodeOutputStream] Told to teardown
Oct 25, 2015 02:32:49:999 [4596] DEBUG - Removed transcode output stream 0411D168, active count 1 => 0
Oct 25, 2015 02:32:50:015 [3052] VERBOSE - [IDLE] Removing (1->0) work item http_download
Oct 25, 2015 02:32:50:015 [3052] VERBOSE - [IDLE] * transcoder - m3794sxyzvoswcdi - 1 active item(s)

Some chunks later.
Oct 25, 2015 02:33:11:554 [3136] VERBOSE - [IDLE] Removing (1->0) work item transcoder - m3794sxyzvoswcdi Oct 25, 2015 02:33:11:554 [3136] VERBOSE - [IDLE] Server is now idle

I don’t use any URL Service, but that problem existed even when I used one. The Files I want to play are H264 AC3 Mkv’s 1080p Movies hosted via http Web. The player always reports the http protocol. Maybe I should try another? HTTPLiveStreaming ?

`
def createEpisodeObject(url, title, rating_key, include_container=False):
container = Container.MKV
video_codec = VideoCodec.H264
optimized_for_streaming = Prefs[‘direct’]

track_object = EpisodeObject(
    key = Callback(
        createEpisodeObject,
        url=url,
        title=title,
        rating_key=rating_key,
        include_container=True
    ),
    title = title,
    rating_key=rating_key,
    items = [
        MediaObject(
            parts = [
                PartObject(key=Callback(PlayVideo, url=url))
            ],
            container = container,
            video_codec = video_codec,
            bitrate = 3244,
            audio_channels = 6,
            video_resolution = 1080,
            duration = 18000000,
            video_frame_rate = 24,
            # audio_codec = AudioCodec.AAC, 
            optimized_for_streaming = optimized_for_streaming
        )
    ]
)

if include_container:
    return ObjectContainer(objects=[track_object])
else:
    return track_objectl

`

I moved duration from the MediaObject to the episode object. Could this be the issue? At the Moment I have a movie playing for an hour already. Before I’d never reached more than ~40 minutes.

Getting the same issue here. Shows and movies randomly stop every 20 - 40 minutes.

Console shows “ERR_INCOMPLETE_CHUNKED_ENCODING”.