Discover why a screen recorded video with Kazam in Ubuntu cannot be played in Windows.

The other day, during the recording of a videotutorial for our YouTube channel, i needed to record the video directly from an Ubuntu operative system, not from a Virtual Machine. This forced me to install a new useful utility named Kazam to record the screen. Kazam is a simple screen recording program that will capture the content of your screen and record a video file that can be played by any video player that supports VP8/WebM video format. Optionally you can record sound from any sound input device that is supported and visible by PulseAudio.

This utility can be easily installed with:

sudo apt-get install kazam

The program is really simple and is easy to use, so the screen recording wasn't a problem for me. Once the video was generated, i was able to play it in Ubuntu without any problem and it looked pretty smooth. I just simply copied the .mp4 file into a USB and turned off my computer with Windows.  For my surprise when i tried to edit the video in Sony Vegas 13 in Windows:

Sony Vegas MP4 File generated with Kazam

The file can't be played, so there's no preview available, sound or peaks, nothing. I even tried to play the file in other player but it doesn't work in Windows. But, when i return to the Ubuntu environment, the file can be played without any problem. The problem lies basically on the codecs of the video generated by Kazam, Kazam's codecs are quite straight forward (H.264). To easiest way to solve this issue is to re-encode the MP4 file/or other format again into MP4 but with FFMPEG using the regular libx264 codec.

Solution (encode file to mp4 with regular libx264)

The only solution is to encode the MP4 file with a regular codec using FFMPEG in Ubuntu, before using the file in Windows.

sudo apt-get install ffmpeg

You can do this as well in Windows, but you need to download manually the installer of FFMPEG and then add the directory to the PATH environment variable. Once the tool is installed, you can easily convert the file to a regular MP4 file with the following command (replace input_file.mp4 and output_file.mp4):

ffmpeg -y -i input_file.mp4 -c:v libx264 -c:a aac -strict experimental -tune fastdecode -pix_fmt yuv420p -b:a 192k -ar 48000 output_file.mp4

Sony Vegas is pretty picky with H.264 (AVC) files and it refuses to accept files produced with default settings, however converting your files with the previous command will do the trick and vegas will accept the file.

Happy editing !


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors