First, I record a video with the next options:
Code: Select all
with picamera.PiCamera() as camera:
camera.resolution = (640,480)
camera.framerate = 25
camera.start_preview()
camera.start_recording('video.h264', intra_period=25)
start = dt.datetime.now()
#14h = 50400 seconds
while (dt.datetime.now()-start).seconds < 50400:
#My code is here
#When an events occurs, it saves the time of the event in a file
event = (dt.datetime.now()-start).seconds
#Finally, it updates camera text with the current time
camera.annotate_text = dt.datetime.now().strftime('%H:%M:%S.%f')
camera.stop_recording()
Then, I convert the video using MP4Box:
Code: Select all
$ MP4Box -add input.h264 -fps 25 output.mp4
Does anyone know why this happens?
It is a problem because I want to start playing the video at the event time, but being the output video longer, the event time that I saved doesn't match.
Record only the events is not a posibility.
I also tried to convert the video with ffmpeg/avconv but I had the same result.
Code: Select all
$ avconv -r 25 -i input.h264 -vcodec copy output.mp4
