简体   繁体   English

MPlayer无法播放来自同一来源的特定类型内容的HTTP视频流

[英]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: 我目前正在利用以下优势实施云游戏解决方案:

  • Nvidia Capture SDK Nvidia Capture SDK
  • Nvidia Video Codec SDK Nvidia视频编解码器SDK
  • FFmpeg FFmpeg
  • MPlayer MPlayer

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. Nvidia Capture SDK用于生成填充层(通过DXGI.dll),拦截并捕获DirectX帧,以便可以将它们传递到Nvidia Video Codec SDK进行编码,以编码为h264视频格式。 All this is done within DXGI.dll. 所有这些都是在DXGI.dll中完成的。

I then pass the encoded video to FFmpeg. 然后,我将编码后的视频传递给FFmpeg。 FFmpeg acts as an HTTP server that broadcasts the video stream for MPlayer to play. FFmpeg充当HTTP服务器,广播视频流以供MPlayer播放。

Problem 问题

I am running an Unreal Engine 4 game called " Epic Survival Game Series ". 我正在运行一个名为“ Epic Survival Game Series ”的虚幻引擎4游戏。 The Nvidia Capture SDK's shim layer kicks off when the game starts, and FFmpeg launches the HTTP server to start streaming. Nvidia Capture SDK的填充程序层在游戏开始时启动,FFmpeg启动HTTP服务器以开始流式传输。 However, when I start MPlayer to receive the stream, MPlayer stops at the following message, and nothing happens after that. 但是,当我启动MPlayer接收流时,MPlayer在以下消息处停止,此后什么也没有发生。

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. 关键是,当我使用ffplay播放同一视频时,它可以正常工作。 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. 当我启动另一个名为“第一人称射击者模板”的虚幻引擎4游戏时,MPlayer也可以播放该视频。 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. 另外,如果我修改了生存游戏以通过跳过菜单直接加载到游戏级别中,则MPlayer也可以播放视频。

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. 使用FFmpeg将视频写入文件而不是将其流式传输到视频也可以,无论是游戏还是加载到菜单或游戏级别中。

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. 编辑:我忘记提到的一个奇怪的怪癖是MPlayer确实能够在非常罕见的情况下播放视频-也许每10-20次尝试一次。

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 (1)对于Nvidia Capture SDK,我使用SDK中提供的DXIFRShim示例。

(2) for the Nvidia Video Codec SDK, I use the provided NvEncoder example that is provided in the SDK (2)对于Nvidia视频编解码器SDK,我使用SDK中提供的NvEncoder示例。

(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. (3)我使用的FFmpeg命令是这样的: ffmpeg -i - -listen 1 -threads 1 -vcodec copy -preset ultrafast -an -tune zerolatency -f h264 http://address:port Nvidia Video Codec SDK中的编码帧通过管道传输到FFmpeg。

(4) The MPlayer command I use is this: mplayer -quiet -vo gl -nosound -benchmark http://address:port (4)我使用的MPlayer命令是这样的: 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的原因,所以我只玩过MPlayer参数。 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. 这些都不起作用。

It has been a while, and I asked the same question and got an answer on the MPlayer mailing list . 已经有一段时间了,我问了同样的问题,并在MPlayer邮件列表中得到了答案。 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. 答:MPlayer自动检测视频编解码器存在问题,因此在播放视频时, -demuxer h264es需要在命令中明确声明。 Using a larger -cache value also works. 使用更大的-cache值也可以。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM