I decided to finally post this after no avail and several videos that are unusable. I made a python script to record and convert video from a raspberry pi running in the nosecone of my rocket. However the red-satruation content of these videos are extremely high. I've tried using the documentation for the picamera to improve my quality, however, much to chagrin I am still getting poor results. This is the script I am working with;

import picamera
import datetime as dt
from time import sleep
import os

def print_c(msg):
    file = open('cam_log', "a+")
    file.write(msg + "\n")

# length of video in secs
# vid_length = int(input('>> how long do you want the video to be? (use integers) $ '))
vid_length = 60

# resolution
height = 1280
width = 720

# framerate
fps = 30

# camera initialization
camera = picamera.PiCamera()
camera.resolution = (height, width)
camera.framerate = fps
camera.brightness = 55

# file location
save_name = "/"

while True:
    filename = dt.datetime.now().strftime("%Y-%m-%d_%H.%M.%S")
    completed_video_name = os.path.join(save_name, filename + ".h264")

    # start recoding
    print_c('>> camera is now recording!')
    camera.start_recording(completed_video_name, quality=15)

    # stop recording


    # wraps h264 file in mp4
    print_c('>> converting from h264 to mp4!')
    # exec_cmd = 'MP4Box -add $s.h264 $s.mp4'.replace('$s', filename)
    exec_cmd = 'MP4Box -add ' + filename + '.h264 ' + filename + '.mp4' 
    command = os.popen(exec_cmd)    

    # removes h264'
    exec_rm = 'sudo rm $s.h264'.replace('$s', filename)
    command1 = os.popen(exec_rm)

a video example can be found here: https://imgur.com/IibggDD

  • run tests using different color cards .... do not use any cover on the lens ... add the results to your question .... you can use paint sample cards from a paint shop ... just pick some that have bright, close to primary colors – jsotola Oct 15 at 0:40
  • Run sudo apt update && sudo apt dist-upgrade -y to eliminate the bug in the camera code that the Raspberry Pi Foundation folks introduced. – Dougie Oct 15 at 7:06

Your Answer

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

Browse other questions tagged or ask your own question.