I tried to use below command to capture the video, but output video fps only 25:

raspivid -rot 180 -t 10000 -w 1280 -h 720 -fps 60 -b 1200000 -p 0,0,1280,720 -o test.h264

Any one can help me?

  • what is the frame rate of the video that you are trying to capture? – jsotola Jan 12 at 3:11

Try running raspivid with one of the modes listed here under --mode, -md https://www.raspberrypi.org/documentation/raspbian/applications/camera.md

In those two tables you can also see that 60fps is only supported for 640x480 video (Version 1 camera) or 1280x720 (Version 2).

RPi Camera Modes


You are recording raw h264 which does not contain any timestamp information. What are you using to play back the recording - its probably just reporting a default fps value. You can calculate the approximate fps based on the number of frames and the duration (seconds) of the recording.

From a Raspberry Pi Engineer:

You are recording at 30fps, but a raw H264 elementary stream (what's in test.h264) has no timestamp information. MP4Box is assuming 25fps in the absence of any other information. The fact that you recorded for 10seconds and got 295 frames gives you 29.5fps. (It takes a few 100ms to get going at the start).

There is a mode for raspivid where it will write out all the timestamps to a second file, and mkvmerge can use that when putting the H264 stream into the container.

raspivid -w 1280 -h 1024 -fps 30 -t 10000 -o test.h264 -pts timestamps.txt
mkvmerge -o bb.mkv --timecodes 0:timestamps.txt test.h264

That does produce an mkv file instead of mp4, but almost all players support mkv as well.

Alternatively you can just add "-fps 30" to your MP4Box line and it'll assume the H264 ES is at 30fps. (Location within the command may be important. It'll either be "MP4Box -fps 30 -add ...", or "MP4Box -add test.h264 -fps 30 ...")


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.