This repository contains some bash scripts to process your GoPro media files (.JPG .MP4). They are optimized for GoPro Hero 3+, but its parameters can be easily changed for your particular GoPro. The scripts works thanks to the GoPro naming convention.
Download the repository and start using it
git clone https://github.com/ponchoblesa/GoPro-Studio-for-linux.git
Total unattended and customizable. Organize your files in your computer by date and type (video, chaptered video, timelapse photos and normal photos), like the GoPro Studio does. For each day, the script will create a folder and inside, will classify the files by type, including organizing the timelapses in different folders.
Open the script and customize the vars:
CAMERA_DIR="/media/user/MyCard" // The root folder where the memory card with the files is
DEST_DIR="~/GoPro" // The path where to import the files
OVERWRITE_FILES=false // Clear what it does right?
DATE="*" // Date pattern yyyy-mm-dd.
Example1: 2015-10-15 (Only files of that day).
Example2: 2015-11-* (All the files of November).
Example3: * (All the files regardless the date)
GET_TIMELAPSE=true // Set to false if you do not want to import a specific type of file
GET_PHOTOS=true
GET_VIDEOS=true
Then save it and execute it from terminal
bash gopro_import.sh
Also total unattended and customizable. It will process you local GoPro files with some common features. It will process folder by folder, but creating threads of processing. So depending on the amount of files and the feature, the process will take advantage of all the capabilities of your computer in order to perform all the features as faster as possible. For this reason, my advice is to not to run any other thing while running this script.
In the case of wanting to kill the process, press ctrl+c as many time as needed until all threads are killed properly.
-
ImageMagick: sudo apt-get install imagemagick
-
MenCoder: sudo apt-get install mencoder
-
Ffmpeg: Follow instructions in the website to install
-
HandBrake CLI: Download/Upgrade it from this repository:
sudo apt-add-repository ppa:stebbins/handbrake-snapshots sudo apt-get update apt-get install --only-upgrade handbrake-cli
Open the script and customize the vars:
MEDIA_DIR="~/GoPro/2015-*" // The folder that you want to process with date pattern yyyy-mm-dd.
Example1: ~/GoPro/2015-10-15 (Only files of that day).
Example2: ~/GoPro/2015-11-* (All the files of November).
Example3: ~/GoPro/* (All the files regardless the date)
COLLAGE=true // Set to false if you do not want to run a particular feature
FISHEYE=true
VIDEO=true
VIDEO_DEVICE_OPTIMIZED=true
TIMELAPSE=true
DEFAULT_FPS=true // Set it to false if you want to customize the frames per second
FPS_SLOW=0 of the timelapse video. Then change the zero value for the two desired
FPS_FAST=0 fps values for the videos.
Then save it and execute it from terminal
bash gopro_process.sh
TIMELAPSE=true
By default it will create two videos of two different speeds. If the timelapse is bigger than a hundred of photos, the speeds are 20fps and 10fps. Otherwise it will be 5fps and 3fps. If you want to change these values, you have to unlock the default fps var. For example, for a configuration of 13fps and 17fps, the initial variables are:
DEFAULT_FPS=false
FPS_SLOW=13
FPS_FAST=17
COLLAGE=true
With the pictures of the timelapse, it will create 4 collages of two different configuration, 2 of them big if there are many pictures.
FISHEYE=true
It will create a folder inside the photos path with the edited pictures. The script is optimized for GoPro Hero3+. If you want to change these parameters, edit the line of the script with the desire parameters:
mogrify -distort barrel "0 0 -0.3" *.JPG
VIDEO=true
It will merge in one all the videos of each day. The result will be a single file [date].mp4 with all the videos of these day in chronological order.
VIDEO_DEVICE_OPTIMIZED=true
This video is compressed in order to get a lighter file with almost the same video quality. If the variable "VIDEO_DEVICE_OPTIMIZED" is true, it will also crop its resolution optimized for device, giving as a result an even lighter video which display perfectly in every device. Otherwise, the resolution will be bigger and optimized for big screens.
For compression is used a preset of Handbrake a bit modified. If you want to change this default behaviour, take a look to the documentation of Handbrake CLI and edit the variable $handbrake_opts of the script.
In the case of interrupting this process abruptly, a temp folder inside the video folder could remain. Delete from this temp folder all the files which have a creation date of the same day of execution of the script, and run the script again. If you are not quite sure of which files should be deleted, remove the entire folder manually and run it again.
This feature allows to include in the final video the desires timelapse videos. It will work only if the timelapse where created also with this script and following the naming convention. In order to use that, just copy to the "Videos" folder the timelapse videos you would like to include in your merged video.
Example of content in the video folder:
~/GoPro/2015-10-16/Videos$ ls -lrt
oct 16 00:59 GOPR5342.MP4
oct 16 11:53 GOPR6872.MP4
oct 16 12:42 003_FPS5.mp4
oct 16 13:27 GOPR9689.MP4
oct 16 13:48 012_FPS20.mp4
oct 16 17:20 028_FPS10.mp4
oct 16 22:20 GOPR4544.MP4
oct 16 22:24 005_FPS3.mp4
Running the script with these files will give you a video named 2015-10-16.mp4 with all these videos merged in chronological order.
The MIT License (MIT)
Copyright (c) 2015 ponchoblesa
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.