[HOW-TO] Encode frame rate in mp4, on Pi5
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python, raspberry-pi
- Domain
- audio-video-rtc, embedded-iot
Research direction
Start by reproducing the issue with the Picamera2 snippet using create_video_configuration and start_and_record_video on the stated Bookworm and picamera2 0.3.17 setup. Inspect the resulting test.mp4 metadata alongside its frame timestamps; done means the output reports the configured 10 Hz frame rate without breaking recording.
Written by the indexing model from the issue text.
Description
Hi,
I'm recording from a Raspberry Pi HQ camera on a Pi 5. Despite trying a whole bunch of different ways, I'm having trouble getting a correct frame rate written into the output file's metadata.
Here's the simplest code fragment to reproduce the issue:
from picamera2 import Picamera2
picam2 = Picamera2()
video_config = picam2.create_video_configuration(controls={'FrameRate': 10})
picam2.start_and_record_video("test.mp4", config=video_config, duration=10)
The resulting video is recorded at the proper 10 Hz framerate +- some jitter (confirmed by filming a stopwatch over several minutes, or by reading out individual timestamps for each frame), but the mp4 reports the framerate as about 11.1 Hz (as read by Windows, VLC or Matlab). For longer videos, the discrepancy is smaller (e.g. 10.05Hz for a 3 minute video). Now, when analysing the videos, I could read out the individual timestamps for each frame, but for longer videos that would slow down analysis quite a bit.
Is there any way to correct this, or manually write the correct frame rate into output files?
Many thanks in advance for your help!
For reference, I'm running picamera2 version 0.3.17 on a fresh Bookworm installation.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 258
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raspberrypi/picamera2
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
raspberrypi/picamera2#1405 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
raspberrypi/picamera2#1404 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 57/100
raspberrypi/picamera2#1403 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
raspberrypi/picamera2#1392 · 13 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
raspberrypi/picamera2#1389 · 4 comments ·
All issues in raspberrypi/picamera2
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100