简体   繁体   English

ffmpeg API编码mpeg-4 Windows Media Player错误

[英]ffmpeg API encoding mpeg-4 Windows Media Player error

We have an app that uses the ffmpeg C API to encode mpeg-4 (AV_CODEC_ID_MPEG4) files in a mp4 container. 我们有一个应用程序使用ffmpeg C API来编码mp4容器中的mpeg-4(AV_CODEC_ID_MPEG4)文件。 The problem is that the files don't play in Windows Media Player or the Windows 10 video player "Movies & TV" app. 问题是文件无法在Windows Media Player或Windows 10视频播放器“电影和电视”应用程序中播放。 It plays in VLC, google chrome, Ubuntu's video player, and all other video players I've tried. 它在VLC,谷歌浏览器,Ubuntu的视频播放器以及我尝试过的所有其他视频播放器中播放。

The two Windows players are able to play other files encoded with mpeg-4 in mp4 container. 这两个Windows播放器能够在mp4容器中播放用mpeg-4编码的其他文件。 I also tested transcoding video files to the same format using the command line 'ffmpeg' tool and was successfully able to play the video using the following command: 我还使用命令行'ffmpeg'工具测试了将视频文件转码为相同格式,并成功使用以下命令播放视频:

ffmpeg input.avi -c:v mpeg4 output.mp4

While I found the following commands do not work: 虽然我发现以下命令不起作用:

ffmpeg input.avi -c:v mpeg4 -vtag xvid output.mp4

ffmpeg input.avi -c:v libxvid output.mp4

# the last command wont play with windows media player but VLC can still play it. If the extension of the output file is changed to avi for the last two commands then Windows media player can play it.

I started looking at the ffmpeg src code but it appears a bit large/complex, I tried using the simpler "encode_video.c" example, which was able to encode a video and play it in Ubuntu's default video player but VLC nor Windows Media Player could play it. 我开始查看ffmpeg src代码,但它看起来有点大/复杂,我尝试使用更简单的“encode_video.c”示例,该示例能够编码视频并在Ubuntu的默认视频播放器中播放,但VLC也不是Windows Media Player可以玩它。

We need to encode these using the ffmpeg API, not the command line tool, so I am wondering what the ffmpeg command line tool is doing that I am not, or any ideas on what the problem could be and how to get this working. 我们需要使用ffmpeg API而不是命令行工具对这些进行编码,所以我想知道ffmpeg命令行工具在做什么我不是,或者对问题可能是什么以及如何使其工作的任何想法。

Thanks. 谢谢。

According to this and this XVid playback is not supported by Movies & TV app as well as other Win Store apps using WinRT out of box video capabilities. 根据这个这个 XVid播放不支持电影和电视应用程序以及使用WinRT开箱即用视频功能的其他Win Store应用程序。 And according to this it is also not supported by Windows Media Player. 根据一点,Windows Media Player也不支持它。 If you've managed to play it using Windows Media Player then most likely you had corresponding third-party Direct Show codec installed. 如果您已设法使用Windows Media Player播放它,则很可能您已安装相应的第三方Direct Show编解码器。 There is actually no real point to use XVid in 2017, just use h264 instead. 2017年使用XVid实际上没有任何意义,只需使用h264。

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

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