tarina

git clone https://git.tarina.org/tarina
Log | Files | Refs | README | LICENSE

commit 6e113408a17db2cbd82fc49a3488e5e83ddff401
parent 51cda0fb46eac797a62c7ef9da256151e482dbc8
Author: root <Robin Bäckman>
Date:   Wed, 10 Aug 2016 20:16:08 +0000

Merge branch 'master' of https://bitbucket.org/rbckman/tarina

Diffstat:
MINSTALL | 2+-
MREADME | 32+++++++++++++++++++++++---------
MVERSION | 2+-
Mstartinterface.sh | 2+-
Mtarina.py | 152++++++++++++++++++++++++++++++++++++-------------------------------------------
5 files changed, 95 insertions(+), 95 deletions(-)

diff --git a/INSTALL b/INSTALL @@ -20,7 +20,7 @@ enable camera, extend filesystem and reboot 2. sudo apt-get update 3. sudo apt-get upgrade -4. sudo apt-get install git python-picamera python-imaging python-pexpect libav-tools gpac omxplayer sox cpufrequtils +4. sudo apt-get install git python-picamera python-imaging python-pexpect libav-tools gpac omxplayer sox cpufrequtils usbmount 5. git clone https://rbckman@bitbucket.org/rbckman/tarina.git diff --git a/README b/README @@ -1,6 +1,4 @@ -Tarina - -DIY filmmaking device for Raspberry pi +Tarina - filmmaking interface for Raspberry pi video + sound recorder for the Raspberry Pi using the Pi Camera and Adafruit Pitft screen and C-Media USB Audio VIA VT1620A. adafruit kernel with the 3.5 tft https://learn.adafruit.com/adafruit-pitft-3-dot-5-touch-screen-for-raspberry-pi/easy-install @@ -14,20 +12,28 @@ Lens I'm trying out now Blender file and printable stls in 3d folder - ---------------||Installing||----------------- -cd /home/pi && git clone https://bitbucket.org/rbckman/tarina.git +1. sudo apt-get install git python-picamera python-imaging python-pexpect libav-tools gpac omxplayer sox cpufrequtils usbmount -sudo apt-get update && sudo apt-get install python-pip +2. git clone https://rbckman@bitbucket.org/rbckman/tarina.git +3. put this line in the end of /etc/fstab +tmpfs /mnt/tmp tmpfs defaults 0 0 ----------------||Configurations||--------------------- +4. reboot +5. cd /home/pi/tarina/ + +6. python tarina.py + +more install instructions in INSTALL file + +---------------||Configurations||--------------------- Booting to Tarina -Raspbian Wheezy (with init) +Raspbian Wheezy (init) 1. nano /etc/inittab 2. comment out line 54 @@ -43,7 +49,7 @@ if [ $(tty) == /dev/tty1 ]; then python tarina.py > /dev/tty2 2>err.log fi -Raspbian Sid instructions (with systemd) soon... +Raspbian Jessie instructions (systemd) ---------------||Couldn't have been done without these||----------------------- @@ -59,9 +65,15 @@ Picamera python module Dave Jones, for the awesome picamera python module http://picamera.readthedocs.org +Python programming language + Tasanakorn for fbcp so you can preview on the pitft https://github.com/tasanakorn/rpi-fbcp +Libav-tools (ffmpeg) + +GPac library with MP4Box + Aplay The awesome wav player/recorder with VU meter http://alsa.opensrc.org/Aplay @@ -70,6 +82,8 @@ Omxplayer Video player on the Raspberry pi https://github.com/huceke/omxplayer +Sox + Texy https://www.raspberrypi.org/forums/viewtopic.php?t=48967 diff --git a/VERSION b/VERSION @@ -1,2 +1,2 @@ -0.84 +0.85 Eisenstein diff --git a/startinterface.sh b/startinterface.sh @@ -1,5 +1,5 @@ #!/bin/bash -echo "Tio 30 photobooth camera" > /mnt/tmp/vumeter +echo "Have fun!" > /mnt/tmp/vumeter echo "For the lulz" > /mnt/tmp/interface cd ./vc/src/hello_pi/hello_interface ./camerainterface.bin diff --git a/tarina.py b/tarina.py @@ -1,7 +1,7 @@ #/usr/bin/env python # -*- coding: utf-8 -*- -#Tarina - Adafruit, Raspberry pi, Picamera filmmaking interface. +#Tarina - Raspberry pi filmmaking interface. #Copyright (C) 2016 Robin J Bäckman #This program is free software: you can redistribute it and/or modify @@ -217,8 +217,8 @@ def renderlist(filmname, filmfolder, scene): filename = 'scene' + str(scene).zfill(3) + '_shot' + str(shot).zfill(3) + '_take' + str(takes).zfill(3) scenefiles.append(folder + filename) shot = shot + 1 - writemessage(str(len(scenefiles))) - time.sleep(2) + #writemessage(str(len(scenefiles))) + #time.sleep(2) return scenefiles #-------------Render thumbnails------------ @@ -285,58 +285,6 @@ def removeimage(camera, overlay): overlay = None camera.start_preview() -#-------------Browse------------------ - -def browse(filmname, filmfolder): - header = 'Select scene & shot' - scenes, shots, takes = countlast(filmname, filmfolder) - menu = 'SCENE', 'SHOT', 'TAKES' - selected = 0 - scene = scenes - shot = shots - take = takes - while True: - settings = str(scene), str(shot), str(takes) - writemenu(menu,settings,selected,header) - time.sleep(0.2) - middlebutton = GPIO.input(5) - upbutton = GPIO.input(12) - downbutton = GPIO.input(13) - leftbutton = GPIO.input(16) - rightbutton = GPIO.input(26) - if upbutton == False: - if selected == 0: - if scene < scenes: - scene = scene + 1 - shots = countshots(filmname, filmfolder, scene) - shot = shots - else: - if shot < shots: - shot = shot + 1 - takes = counttakes(filmname, filmfolder, scene, shot) - take = takes - elif downbutton == False: - if selected == 0: - if scene > 1: - scene = scene - 1 - shots = countshots(filmname, filmfolder, scene) - shot = shots - else: - if shot > 1: - shot = shot - 1 - takes = counttakes(filmname, filmfolder, scene, shot) - take = takes - elif rightbutton == False: - if selected == 0: - selected = 1 - elif leftbutton == False: - if selected == 1: - selected = 0 - elif middlebutton == False: - writemessage('Now recording to scene ' + str(scene) + ' shot ' + str(shot) + ' take ' + str(take + 1)) - time.sleep(2) - return scene, shot, take + 1 - #-------------Browse2.0------------------ def browse2(filmname, filmfolder, scene, shot, take, n, b): @@ -371,9 +319,9 @@ def browse2(filmname, filmfolder, scene, shot, take, n, b): takes = counttakes(filmname, filmfolder, scene, shots) shot = shots take = takes - if take == 0: - shot = shot - 1 - take = counttakes(filmname, filmfolder, scene, shot - 1) + #if take == 0: + # shot = shot - 1 + # take = counttakes(filmname, filmfolder, scene, shot - 1) elif selected == 1 and b == -1: if shot > 1: shot = shot - 1 @@ -765,7 +713,7 @@ def compileshot(filename): def render(scene, shot, filmfolder, filmname, renderedshots, renderfullscene, filmfiles, filename, tarinafolder): #print filmfiles - writemessage('Hold on, rendering ' + str(len(filmfiles)) + ' files ' + str(renderedshots) + str(renderfullscene)) + writemessage('Hold on, rendering ' + str(len(filmfiles)) + ' files') time.sleep(2) render = 0 #CHECK IF THERE IS A RENDERED VIDEO @@ -786,7 +734,8 @@ def render(scene, shot, filmfolder, filmname, renderedshots, renderfullscene, fi videomerge.append('-cat') videomerge.append(f + '.h264') videomerge.append('-new') - videomerge.append(filename + '.h264') + videomerge.append(filename + '.mp4') + #videomerge.append(filename + '.h264') call(videomerge, shell=False) #how to insert somekind of estimated time while it does this? ##PASTE AUDIO TOGETHER writemessage('Rendering sound') @@ -799,26 +748,15 @@ def render(scene, shot, filmfolder, filmname, renderedshots, renderfullscene, fi audiomerge.append(filename + '.wav') call(audiomerge, shell=False) ##CONVERT AUDIO IF WAV FILES FOUND - if os.path.isfile(filename + '.wav'): - call(['avconv', '-y', '-i', filename + '.wav', '-acodec', 'libmp3lame', filename + '.mp3'], shell=False) - ##MERGE AUDIO & VIDEO - writemessage('Merging audio & video') - call(['MP4Box', '-add', filename + '.h264', '-add', filename + '.mp3', '-new', filename + '.mp4'], shell=False) - else: - writemessage('No audio files found! View INSTALL file for instructions.') - call(['MP4Box', '-add', filename + '.h264', '-new', filename + '.mp4'], shell=False) - #call(['MP4Box', '-add', filename + '.h264', '-new', filename + '.mp4'], shell=False) - #shotsrendered = shot + #if os.path.isfile(filename + '.wav'): + # call(['avconv', '-y', '-i', filename + '.wav', '-acodec', 'libmp3lame', filename + '.mp3'], shell=False) + # ##MERGE AUDIO & VIDEO + # writemessage('Merging audio & video') + # call(['MP4Box', '-add', filename + '.h264', '-add', filename + '.mp3', '-new', filename + '.mp4'], shell=False) + #else: + # writemessage('No audio files found! View INSTALL file for instructions.') + # call(['MP4Box', '-add', filename + '.h264', '-new', filename + '.mp4'], shell=False) return renderedshots, renderfullscene, filename - #play = True - #time.sleep(1) - #while play == True: - # middlebutton = GPIO.input(5) - # if middlebutton == False: - # os.system('pkill -9 omxplayer') - # play = False - # time.sleep(0.2) - # break #---------------Play------------------------ @@ -879,6 +817,43 @@ def viewfilm(filmfolder, filmname): scene = scene + 1 return filmfiles +#--------------Copy to USB------------------- + +def copytousb(filmfolder, filmname): + pressed = '' + buttonpressed = '' + buttontime = time.time() + holdbutton = '' + writemessage('Searching for usb storage device, middlebutton to cancel') + while True: + pressed, buttonpressed, buttontime, holdbutton = getbutton(pressed, buttonpressed, buttontime, holdbutton) + usbconnected = os.path.ismount('/media/usb0') + if pressed == 'middle': + break + time.sleep(0.02) + if usbconnected == True: + writemessage('USB device found, copying files...') + #COUNT FILES + scenes, shots, takes = countlast(filmname, filmfolder) + scene = 1 + filmfiles = [] + while scene <= scenes: + shots = countshots(filmname, filmfolder, scene) + if shots > 0: + filmfiles.extend(renderlist(filmname, filmfolder, scene)) + scene = scene + 1 + #RENDER FILES TO MP4 ON USB STICK + os.system('mkdir -p /media/usb0/' + filmname) + for f in filmfiles[:]: + os.system('MP4Box -add ' + f + '.h264 -new /media/usb0/' + filmname + '/' + f[-24:] + '.mp4') + os.system('cp ' + f + '.wav /media/usb0/' + filmname + '/' + f[-24:] + '.wav') + os.system('sync') + writemessage('all files copied successfully!') + time.sleep(1) + writemessage('You can safely unplug the usb device now') + time.sleep(2) + return + #-------------Upload Scene------------ def uploadfilm(filename, filmname): @@ -986,7 +961,7 @@ def main(): #MENUS menu = 'MIDDLEBUTTON: ','SHUTTER:', 'ISO:', 'RED:', 'BLUE:', 'BRIGHT:', 'CONT:', 'SAT:', 'FLIP:', 'BEEP:', 'LENGTH:', 'MIC:', 'PHONES:', 'DSK:', '', 'SCENE:', 'SHOT:', 'TAKE', '', '' - actionmenu = 'Record', 'Play', 'Copy to USB', 'Upload', 'Update', 'New Film', 'Load Film', 'Remove', 'Photobooth' + actionmenu = 'Record', 'Play', 'Copy to USB', 'Upload', 'Update', 'New Film', 'Load Film', 'Remove' #STANDARD VALUES selectedaction = 0 @@ -1152,7 +1127,7 @@ def main(): savesetting(camera.brightness, camera.contrast, camera.saturation, camera.shutter_speed, camera.iso, camera.awb_mode, camera.awb_gains, awb_lock, miclevel, headphoneslevel, filmfolder, filmname, scene, shot, take, thefile, beeps, flip, renderedshots) #PHOTOBOOTH - elif pressed == 'middle' and selectedaction == 8: + elif pressed == 'middle' and selectedaction == 81: thefile = filmfolder + filmname + '/' + 'scene' + str(scene).zfill(3) + '/' + filename timelapsefolder = filmfolder + filmname + '/' + 'scene' + str(scene).zfill(3) + '/' + 'timelapse' + str(shot).zfill(2) + str(take).zfill(2) thefile = photobooth(beeps, camera, filmfolder, filmname, scene, shot, take, filename) @@ -1194,6 +1169,11 @@ def main(): renderedshots, renderfullscene, playfile = render(scene, shot, filmfolder, filmname, renderedshots, renderfullscene, filmfiles, renderfilename, tarinafolder) playthis(playfile, camera) + #COPY TO USB + elif pressed == 'middle' and selectedaction == 2: + if recording == False: + copytousb(filmfolder, filmname) + #NEW SCENE elif pressed == 'middle' and selectedaction == 22: if recording == False: @@ -1290,7 +1270,10 @@ def main(): elif selected == 7: camera.saturation = min(camera.saturation + 1, 99) elif selected == 1: - camera.shutter_speed = min(camera.shutter_speed + 210, 50000) + if camera.shutter_speed < 5000: + camera.shutter_speed = min(camera.shutter_speed + 50, 50000) + else: + camera.shutter_speed = min(camera.shutter_speed + 210, 50000) elif selected == 2: camera.iso = min(camera.iso + 100, 1600) elif selected == 9: @@ -1373,7 +1356,10 @@ def main(): elif selected == 7: camera.saturation = max(camera.saturation - 1, -100) elif selected == 1: - camera.shutter_speed = max(camera.shutter_speed - 210, 200) + if camera.shutter_speed < 5000: + camera.shutter_speed = max(camera.shutter_speed - 50, 20) + else: + camera.shutter_speed = max(camera.shutter_speed - 200, 200) elif selected == 2: camera.iso = max(camera.iso - 100, 100) elif selected == 9: