MP4 screencast does not play in web browser
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.
I am facing the same problem, would you mind sharing the exact ffmpeg command you used to convert the video? Thanks a lot.
@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.
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
@gslavin solution works but it's strange that I need to do this for every video. Can we have this issue fix please @kazam?
@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.
Facing the same issue. Also getting:

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.
Same here. It's also not recognized as a video file when you try to share it vía WhatsApp for example
yeah same problem,, if i want move videos to mobile, i have crash on kazam
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:

FWIW, It's still an issue on Ubuntu 20.04.2 LTS, Kazam 1.4.5
Seeing this as well. Kazam 1.4.5, ubuntu 20.04
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.
@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?
@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.
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.
You can try my fix here, it'll change the screencasts to I420(yuv 4:2:0)... https://github.com/niknah/kazam/commit/8995e63cb8cc30e4c623871bedc5050942a36756
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?
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.
IIUC, its because Kazam uses h264 instead of libx264. From here - https://ourcodeworld.com/articles/read/989/kazam-recorded-mp4-video-in-ubuntu-isn-t-recognized-in-sony-vegas-corrupted-mp4-file-for-windows
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.
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)
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. ...