videoffmpegvideo-streamingmplayer

MPlayer not playing HTTP video stream for a specific type of content from the same source


Implementation overview

Before I dive into the question, I need to establish the context from the start.

I am currently implementing a cloud gaming solution utilising the following:

The Nvidia Capture SDK is used to produce a shim layer (via DXGI.dll), intercepting and capturing DirectX frames so that they can be passed to the Nvidia Video Codec SDK to be encoded into an h264 video format. All this is done within DXGI.dll.

I then pass the encoded video to FFmpeg. FFmpeg acts as an HTTP server that broadcasts the video stream for MPlayer to play.

Problem

I am running an Unreal Engine 4 game called "Epic Survival Game Series". The Nvidia Capture SDK's shim layer kicks off when the game starts, and FFmpeg launches the HTTP server to start streaming. However, when I start MPlayer to receive the stream, MPlayer stops at the following message, and nothing happens after that.

libavformat version 57.72.101 (internal) Stream not seekable! H264-ES file format detected

The thing is, when I play the same video using ffplay, it works without any issue. This is not the only quirk. When I launch a different Unreal Engine 4 game called "First Person Shooter Template", MPlayer can play that video as well. Also, if I modify the Survival Game to load directly into the game level by skipping the menu, MPlayer is also able to play the video.

Using FFmpeg to write the video to a file instead of streaming it to a video also works, no matter the game or whether I loaded into the menu or game level.

This is very strange and I do not have any idea why this is the case. Any ideas?

Edit: One strange quirk I forgot to mention is that MPlayer does manage to play the video in very rare occasions - maybe once every 10-20 tries or so.

Implementation Details

Additional details of how certain parts are implemented.

(1) For the Nvidia Capture SDK, I use the provided DXIFRShim example that is provided in the SDK

(2) for the Nvidia Video Codec SDK, I use the provided NvEncoder example that is provided in the SDK

(3) The FFmpeg command I use is this: ffmpeg -i - -listen 1 -threads 1 -vcodec copy -preset ultrafast -an -tune zerolatency -f h264 http://address:port The encoded frames from Nvidia Video Codec SDK is piped to FFmpeg.

(4) The MPlayer command I use is this: mplayer -quiet -vo gl -nosound -benchmark http://address:port

Things I've tried

I am suspecting MPlayer to be the cause, so I've only played around with MPlayer parameters. mplayer http://address:port

mplayer -fps 30 -vo gl -nosound -benchmark http://address:port

mplayer -fps 30 -screenw 720 -screenh 1280 -vo gl -nosound -benchmark http://address:port

mplayer -fps 30 -vo directx -nosound -benchmark http://address:port

mplayer -fps 30 -vo null -nosound -benchmark http://address:port

None of these worked.


Solution

  • It has been a while, and I asked the same question and got an answer on the MPlayer mailing list. Just thought I should leave the answer here as well, in case someone comes across the same problem.

    Answer: There is a problem with the autodetection of the video codec by MPlayer, so -demuxer h264es needs to be explicitly stated in the command when playing the video. Using a larger -cache value also works.