Convert stream file (mux) to mp4 gstreamer

5,483

The same happened to me and I was able to restore the video, using a tiny and very easy tu use program: mp4fixer

Step 1: find the mux files

First (for someone else who is a step behind), you need to find the lost temp video files, with .mux extension. In your linux terminal, go to the root folder and type:

$ find . -type f -name "*.mux"

My files were located in my Videos folder:

kazam_mv84r5fr.movie.mux
kazam_mv84r5fr.movie

Step 2: record a new sample video

Now, you need to generate with Kazam a new video of at least 20 seconds long, if possible similar to the one you are trying to recover:

Be sure to record it exactly under the same conditions, including even shaking on the screen (same bitrate), if it was - so we will find exactly what we are looking for. The length of the video is 20 seconds, but if you feed more - it's ok.

You will get a new video file, for example: goodvideo.mp4

Step 3: download mp4fixer

Go to mp4fixer Github page and download the zip file (there is a green dropdown button on the top-right section of the screen).

Save the file somewhere in your disk and unzip it.

Copy the mux files and the sample mp4 file into the same folder.

Step 3: run the program

In the terminal, go to the folder where you unzipped the program and you copied the video files, and run:

$ perl fixer.pl goodvideo.mp4 kazam_mv84r5fr.movie.mux recovered

When the program finishes, you will see some new files in the folder:

recovered-headers.aac
recovered-headers.h264
recovered-nals-stat.txt
recovered-nals.txt
recovered-out-audio.raw  <-- AUDIO
recovered-out-video.h264 <-- VIDEO
recovered-stat.mp4

Step 4: convert to mp4

The last step is to convert the recovered video from .h264 to .mp4, and to include the audio in it.

I did it using the ffmpeg utility (install it first):

$ ffmpeg -i "recovered-out-video.h264" -i "recovered-out-audio.raw" -c:v copy -c:a copy -f mp4 "recovered-video.mp4"

A recovered-video.mp4 working video file will be created in the folder. It worked for me, I hope it works for you as well.

Share:
5,483

Related videos on Youtube

DanFritz
Author by

DanFritz

Updated on September 18, 2022

Comments

  • DanFritz
    DanFritz over 1 year

    I used a program to capture my screen (called Kazam for linux). My computer crashed and I lost my screen capture which I cannot recreate.

    I found two files that seem to hold my video, a .mux and .movie file. I tried using gstreamer or ffmpeg to convert the file bug this wouldn't work. From the Kazam source I saw that gstreamer is used to capture the video.

    When I run tcprobe -i on the file name I get the following output:

    [tcprobe] Digital Video (NTSC)
    [tcprobe] summary for kazam_5bcdqb.movie.mux, (*) = not default, 0 = not detected
    import frame size: -g 720x480 [720x576] (*)
         aspect ratio: 4:3 (*)
           frame rate: -f 29.970 [25.000] frc=4 (*)
    

    Does anybody know how I can convert (using Linux) the mux file to a playable mp4 file?

    Thanks!

    • James
      James almost 11 years
      Don't have an answer myself, but you might find that posting the mediainfo of the file is more useful for assistance as it usually contains more details. mediainfo.sourceforge.net/en FWIW there seems to be a related bug on launchpad which might be answered in the future answers.launchpad.net/kazam/+question/218308
    • DanFritz
      DanFritz almost 11 years
      Thanks for your tip, I got no information from media info. Just the file size. I already know of the launchpad question, I've contacted the original author but no luke so far. When Kazam finished a capturing gstream does "something" and the file is moved... If I only knew the gstream command (try searching in source, but I'm no python expert)