picamera2
picamera2 copied to clipboard
[HOW-TO] How do i tell FfmpegOutput where to save my mp4 ?
Hello there,
I'm trying to save audio and video in mp4 format using the following code:
output = FfmpegOutput('test.mp4', audio=True)
However, I want to specify a different location for the output file. I tried using the following code, hoping to save the file in the /static/videos directory:
output = FfmpegOutput('/static/videos/test.mp4', audio=True)
Unfortunately, it doesn't seem to be working. Do you have any idea what might be causing this issue?
import time
from picamera2 import Picamera2
from picamera2.encoders import H264Encoder
from picamera2.outputs import FfmpegOutput
picam2 = Picamera2()
video_config = picam2.create_video_configuration()
picam2.configure(video_config)
encoder = H264Encoder(5000000)
output = FfmpegOutput('test.mp4', audio=True)
picam2.start_recording(encoder, output)
time.sleep(10)
picam2.stop_recording()
I solve it:
output = FfmpegOutput('/videos/test.mp4', audio=True)
My main.py was not in the root.... main.py *videos
Thx. For this great Picamera Library.