html mp4是空白的,Html Mp4音频工作但不是视频(Html Mp4 Audio Work But Not Video)

Html Mp4音频工作但不是视频(Html Mp4 Audio Work But Not Video)

使用此代码,我可以在我的网页中获得视频播放器,但只能处理音频。 它在音频运行时向我显示黑屏。 视频文件很好,我检查了一次以上。

谢谢大家。

With this code i obtain a video player in my web page but work only the audio. It shows me a black screen while the audio is running. Video files are good, i checked more than one time.

Thanks to all.

原文:https://stackoverflow.com/questions/13460668

更新时间:2019-09-22 08:44

最满意答案

检查正在提供资源的MIME类型。 确保它与您提供的type属性匹配。

Check the MIME-Type that the resource is being served as. Make sure that it matches the type attribute that you have provided.

To do that in tomcat you will have to edit the web.xml file. http://wiki.metawerx.net/wiki/Web.xml.MimeMapping

相关问答

这是我的思想家伙,其中一些可能是正确的,在别人的路上。 我恳求无知,因为没有人真正记录了这个过程,其全部都是有教养的猜测。 AvAssetWriter只对一个文件进行编码,似乎没有办法将编码的视频存储到内存中。 在从后台线程写入文件的时候读取文件来表示一个套接字导致基本流,这基本上是一个m4v,它是一个带有h264 / acc mdata但没有moov原子的容器。 (换句话说,没有标题)没有苹果提供的播放器可以播放此流,但基于ffplay的修改过的播放器应该能够解码和播放流。 这应该是有效的,因为

...

检查正在提供资源的MIME类型。 确保它与您提供的type属性匹配。 要在tomcat中执行此操作,您必须编辑web.xml文件。 http://wiki.metawerx.net/wiki/Web.xml.MimeMapping Check the MIME-Type that the resource is being served as. Make sure that it matches the type attribute that you have provided. To do th

...

AVAsset *asset = [AVAsset assetWithURL:];

BOOL hasVideo = [asset tracksWithMediaType:AVMediaTypeVideo].count > 0;

BOOL hasAudio = [asset tracksWithMediaType:AVMediaTypeAudio].count > 0;

AVAsset *asset = [AVAsset assetWithURL:]

...

FFmpeg将PNG的RGB格式转换为YUV 4:4:4,但大多数播放器只接受YUV 4:2:0,因此您必须明确地转换为 ... -vcodec libx264 -pix_fmt yuv420p ...

FFmpeg is converting the RGB format of the PNG to YUV 4:4:4, but most players only accept YUV 4:2:0, so you've to expressly convert to that ... -vco

...

您是否尝试过重命名视频以进行ogg扩展? I broke down and converted the files to M4V and it's working fine.

了解您正在运行的FMS版本会有所帮助吗? 看起来你至少需要FMS 3.0.2。 Would be helpful to know the version of FMS you are running? It seems like you need at least FMS 3.0.2.

我最后只使用ffmpeg这个解决方案: https://github.com/WritingMinds/ffmpeg-android-java I ended up just using ffmpeg with this solution: https://github.com/WritingMinds/ffmpeg-android-java

我发现什么是错的。 问题出在Visual Sudio上。 我使用的是2012年,并在其下运行我的项目。 然后我尝试将我的项目部署到IIS,在Chrome中打开该页面,发现问题消失了。 所以问题出现在Visual Studio IIS Express中。 在项目属性/ Web中有一个“服务器”部分,您可以在其中选择要使用的Web服务器。 我选择了“使用本地IIS Web服务器”+“使用IIS Express”。 似乎这个网络服务器和Chrome之间存在一些兼容性问题(其他浏览器都可以),因此视频流传

...

您需要指定音频比特率(以下示例中为128k): ffmpeg -y -i input.flv -strict -2 -ar 22050 -ab 512 -b 800k -f mp4 -s 514:362 -c:a aac -b:a 128k output.mp4

You need to specify an audio bitrate (128k in the following example): ffmpeg -y -i input.flv -strict -2 -ar 22050 -ab

...

也许。 尝试添加内容长度标题: header('Content-length: '.filesize($filename));

如果这仍然不起作用,请检查readfile之前的任何输出( echo <?php或 <?php之前的空格)。 还要检查你是否在?>之后没有空格,或者干脆省略?> (如果你以后没有任何东西,这不是强制性的)。 正如布鲁诺所说,为了支持流式传输,您还需要遵守Range标头。 这是一个简单的例子,只尊重左边界: if (empty($_SERVER["HTTP_RANGE"])

...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值