May 232013
 
Manning

This is going to be short and sweet. I picked it up from a video by the Marvellous Matthew Manning (reminds me of the “marvellous mechanical mouse organ” from Bagpuss – Google it if you need to ask) otherwise known as RaspberryPi4Beginners.

Matt’s made a video which complements several of my recent blogs about the Raspberry Pi Camera. His channel is Raspberry Pi For Beginners, but that doesn’t mean that only beginners can learn something from it. I learnt this alternative way of wrapping an .h264 stream to .mp4. It’s much simpler than using FFMPEG and it worked first time for me. (Apparently Stuart Green @sg_84 figured it out).

Installation

sudo apt-get update
sudo apt-get install gpac
y

Usage

MP4Box -add filename.h264 filename.mp4

And you can do it all right there on your Raspberry Pi. Nice one Matt. Check out the full video here…

I met Matt at the Cambridge Jam last week. We had a bit of a chat, but not enough. I find Jams a bit hectic (particularly when I have three demos) and although good for initial meet-ups, perhaps not the best places for lengthy discussion. We must meet again soon and have a proper chat!

  10 Responses to “Another way to convert Raspberry Pi Camera .h264 output to .mp4”

  1. Nice one! Been hinting ages for this!

    The Raspberry Pi Guy

  2. The MP4Box is running perfectly on raspberry, but I have one doubt whe I read AVC-H264 import – frame size 1920 x 1080 at 25.000 FPS. Is the vid 25 FPS? or perhaps 30 FPS

    • The output is 25 fps – at least, that’s what it says on the MP4 file when I look in Windows. I don’t know if there’s a way to get it in 30 fps or not. I expect there is, but I don’t know how to do that. I’m happy with 25 fps as it avoids issues for me when mixing video from different sources. My main video camera is 25 fps.

  3. How can I do this command in a Python script?

    • You can pretty much do anything in Python if you

      from subprocess import call

      near the top of your program, then…
      your_command = "do this" # set your command here

      call ([your_command], shell=True)

Leave a Reply