Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MP4 screencast does not play in web browser #22

Open
baptx opened this issue Nov 3, 2018 · 23 comments
Open

MP4 screencast does not play in web browser #22

baptx opened this issue Nov 3, 2018 · 23 comments

Comments

@baptx
Copy link

baptx commented Nov 3, 2018

After recording a screencast as H264 (MP4), the file plays correctly in a video player like VLC but when we try to play the screencast in a web browser like Firefox, there is an error message "Video can't be played because the file is corrupt".
The workaround is to reencode the video with a tool like ffmpeg / avconc or avidemux (by selecting MP4 AVC x264). The reencoded file also has the advantage to have a smaller size (3 MB instead of 7 MB in my case for the same quality / codec).

Tested on Ubuntu 18.10 (LXQt) with Kazam 1.4.5.

@meggart
Copy link

meggart commented Mar 15, 2019

I am facing the same problem, would you mind sharing the exact ffmpeg command you used to convert the video? Thanks a lot.

@baptx
Copy link
Author

baptx commented Mar 18, 2019

@meggart If I remember correctly, you can fix the issue with a simple command like ffmpeg -i input.mp4 output.mp4. That is what I do also when I download a video that is not well supported by some players.

@gslavin
Copy link

gslavin commented May 10, 2019

I needed to use the following ffmpeg command to get mp4 videos to work on Firefox 66:
ffmpeg -i <your input video>.mp4 -pix_fmt yuv420p -vcodec libx264 -acodec avc <output file name>.mp4

@dudumanbogdan
Copy link

@gslavin solution works but it's strange that I need to do this for every video. Can we have this issue fix please @kazam?

@baptx
Copy link
Author

baptx commented Aug 10, 2020

@gslavin thanks, it looks like ffmpeg -i input.mp4 output.mp4 is not enough to make it play in a web browser like Firefox.
Just using ffmpeg -i input.mp4 -pix_fmt yuv420p output.mp4 without -vcodec libx264 -acodec avc worked for me.

@Mennaruuk
Copy link

Facing the same issue. Also getting:
image

@caliph007
Copy link

I second the change request. I have the same issue. I cannot share a recoreded file in Gdrive (with gdrives own player) because of this issue.

@Davixe7
Copy link

Davixe7 commented Feb 25, 2021

Same here. It's also not recognized as a video file when you try to share it vía WhatsApp for example

@sultanzio
Copy link

yeah same problem,, if i want move videos to mobile, i have crash on kazam

@quezak
Copy link

quezak commented Mar 1, 2021

So what is the cause of this issue? Firefox plays videos from other screen recorders (e.g. Peek) correctly, and the codec in the files from Kazam I've received is regular h264. The file opens fine in smplayer and in Chromium.
Here's the file info tab from smplayer:
image

@tomalec
Copy link

tomalec commented Apr 12, 2021

FWIW, It's still an issue on Ubuntu 20.04.2 LTS, Kazam 1.4.5

@dopeboy
Copy link

dopeboy commented Apr 14, 2021

Seeing this as well. Kazam 1.4.5, ubuntu 20.04

@baptx
Copy link
Author

baptx commented May 3, 2021

The issue seems to be that Kazam uses YUV 4:4:4 which is less common than YUV 4:2:0 (https://wiki.videolan.org/YUV/#Planar_formats). On VLC media player, when opening the menu "Tools -> Media information" or using the Ctrl+I shortcut, we can see in the Codec tab "Decoded format: Planar 4:4:4 YUV", which is not displayed on videos working with Firefox.
However Kazam videos are working in a web browser like Chromium for me too.

@quezak
Copy link

quezak commented May 4, 2021

@baptx thanks for the explanation! Are there any disadvantages to using the most common and most supported 4:2:0 format? ie. is there a reason Kazam chose the less popupar one, or is it just a coincidence and it could be changed to improve support for the resulting videos?

@baptx
Copy link
Author

baptx commented May 5, 2021

@quezak good question, since I don't know I searched "YUV 4:4:4 vs 4:2:0" on a search engine like DuckDuckGo and found this: https://www.reddit.com/r/PS4Pro/comments/8xw3ad/how_important_is_yuv_444_vs_420_re_4k_hdmi/
The best thing would be Firefox to support YUV 4:4:4 like Chromium is doing. Maybe we should create a bug report for Firefox if someone did not already create it.
But for this Kazam issue, it would be nice if we can choose between YUV 4:4:4 and 4:2:0 in the settings. And I would suggest that Kazam uses YUV 4:2:0 by default so the screencast will be supported on most software unless we really want YUV 4:4:4.

@guettli
Copy link

guettli commented Sep 8, 2021

An alternative solution is to use the webm format. At least in my firefox the webm format works.

support looks good:

https://caniuse.com/webm

Kazam supports the webm format via settings. This way I don't need to convert the file before uploading it.

@niknah
Copy link

niknah commented Sep 9, 2021

You can try my fix here, it'll change the screencasts to I420(yuv 4:2:0)...
niknah@8995e63

@guettli
Copy link

guettli commented Sep 16, 2021

You can try my fix here, it'll change the screencasts to I420(yuv 4:2:0)...
niknah@8995e63

Why do you prefer this format to webm?

@niknah
Copy link

niknah commented Sep 17, 2021

webm appears rotated sideways when I view it in vlc. Maybe webm support is better nowadays, video editing programs used to have various problems with it.

@DhruvaSambrani
Copy link

@niknah
Copy link

niknah commented Jan 13, 2022

The ffmpeg command line in the above link includes "-pix_fmt yuv420p" which converts it from yuv444p (not viewable by firefox) to yuv420p (viewable by firefox). If you run that same command line with "-pix_fmt yuv444p" it won't work.

@leonardomarcao
Copy link

So I need to convert each time that I decided to record this? LOL, it's a perfect dream =D

Thank you so much Kazam developer's! (contains irony)

@sadmiral98
Copy link

for weeks i think its whatsapp bug or something that can't play my video.
so its kazam's bug then haha.
and still not fixed for almost 3 years. ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests