搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

Video playback "Video can't be played because the file is corrupt" despite the file being perfectly fine.

  • 4 回覆
  • 1 有這個問題
  • 89 次檢視
  • 最近回覆由 dapal003

more options

So I've noticed how some video files are able to be played back in Firefox. Some are not able to what so ever, for example I've created a text video using this FFPMEG command: ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 testsrc.mp4

which created the following file: https://astolfo.nl/i/z2ada.mp4 Both the uploaded version and the local .mp4 are unable to be played back in Firefox. However opening them up in edge chromium both files play back perfectly. Besides Edge I've also confirmed it plays back nicely in MPV.

I've tried Hardware acceleration, but both having it on and off did not change the fact that these files wouldn't want to playback in Firefox. Safe mode also did not effect this issue.

被選擇的解決方法

Could you try checking for error messages in Firefox's Web Console. Here's how:

You can open the Web Console in the lower part of the tab using either:

  • "3-bar" menu button > Web Developer > Web Console
  • (menu bar) Tools > Web Developer > Web Console
  • (Windows) Ctrl+Shift+k

Then reload the video in the upper part of the tab and watch for error or security messages. Anything that sounds like it could be relevant?

從原來的回覆中察看解決方案 👍 1

所有回覆 (5)

more options

What codec did you use to compress the video in your MP4 file? Firefox should be able to play H.264 encoded video in MP4 containers, using Microsoft's Media Foundation.

https://developer.mozilla.org/docs/Web/Media/Formats/Video_codecs

I have a copy of the old YouTube test page up here as a cross-check:

https://www.jeffersonscher.com/sumo/html5-video.html

If it doesn't show H.264 support, see:

Fix video and audio playback problems on Firefox for Windows

有幫助嗎?

more options

I've used FFMPEG for the encoding I tried with NVENC and also without any hardware acceleration. The video in question is without nvenc, FFPROBE shows: Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 1280x720 [SAR 1:1 DAR 16:9], 94 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default), so just a h264 video (with to my knowledge nothing special)

I've also tried Hvec/h265 which kind of half worked. It showed the media player bar and it played back audio, but there was no video.

As for the HTML5 video, it shows supported for HTMLVideoElement under canPlayType and probably for VP8/H264. Under isTypeSupported they all show supported.

有幫助嗎?

more options

選擇的解決方法

Could you try checking for error messages in Firefox's Web Console. Here's how:

You can open the Web Console in the lower part of the tab using either:

  • "3-bar" menu button > Web Developer > Web Console
  • (menu bar) Tools > Web Developer > Web Console
  • (Windows) Ctrl+Shift+k

Then reload the video in the upper part of the tab and watch for error or security messages. Anything that sounds like it could be relevant?

有幫助嗎?

more options

I totally forgot to check out the console, it has some handy information.

Media resource file:///G:/Videos/clips/testsrc.mp4 could not be decoded. testsrc.mp4 Media resource file:///G:/Videos/clips/testsrc.mp4 could not be decoded, error: Error Code: NS_ERROR_DOM_MEDIA_FATAL_ERR (0x806e0005) Details: auto __cdecl mozilla::SupportChecker::AddMediaFormatChecker(const mozilla::TrackInfo &)::(anonymous class)::operator()(void) const: Decoder may not have the capability to handle the requested video format with YUV444 chroma subsampling.

Turns out that the decoder used in Firefox isn't capable of decoding 4:4:4 or 4:2:2 videos, only 4:2:0. Once exporting to 4:2:0 videos play back in the browser. Acording to the documentation: Most of the profiles use 8-bit color components and 4:2:0 chroma subsampling; The High 10 Profile adds support for 10-bit color, and advanced forms of High 10 add 4:2:2 and 4:4:4 chroma subsampling.

Testing this I found out that using 10bit 4:4:4 still resulted in an "corrupt video" error with the same console message about 444 chroma subsampling not being supported. Strangely enough 4:2:2 and 4:2:0 on 10 bit result in no warning being pushed into the console and the video frame/media controls loading fine but no actual media is present to be played back.

由 dapal003 於 修改

有幫助嗎?

more options

Well my solution was ... after days and days of fiddling around ... quite simply to update ffmpeg!

Now everything works fine!

This is my favourite conversion:

"ffmpeg -i input.mov -vcodec libx265 -acodec mp2 output.mp4"

the libx265 codec produces very small files with no apparent loss in quality

By the way: this problem often doesn't make itself apparent in many situations. For instance, uploading the video to Facebook poses no problems, sound and are there, but posting the same video to Instagram reveals this kind of problem. So *always* use the most recent version of ffmpeg

由 davepolit 於 修改

有幫助嗎?

問個問題

如果您還沒有帳號,您必須先 登入您的帳號 來回覆文章。請 開始一個新問題