Skip to content

Video recording process

mkalam-alami edited this page Nov 14, 2011 · 1 revision

Recording process used for videos (on a Linux environment)

  1. Record desktop with recordMyDesktop
  2. ffmpeg out.ogv out.avi to get a video in a more reusable format (or, better, with custom script here)
  3. Edit with software of choice (ex: OpenShot Video Editor)
  4. Export to a good quality video (got good results with little configuration with high-quality WMV exports)
  5. FLV conversion with customized BinKit script (see below)

#!/bin/bash
IFS=$'\t\n'

# Copyright 2010 by RodrigoPolo.com

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA


# Video Size - Dimensions divisible by 16
# Use 848x480 for widescreen video and 640x480 for standard 4:3 video
SIZE=800x600

# Image Aspect Ratio
# use 16:9 for widescreen video and 4:3 for standar video
ASPECT=4:3

# Frame Rate - for 29.97 use 30000/1001 and for 23.976 use 24000/1001
FRAME_RATE=15

# Keyframe every # frames, recomended use the same frame rate value but as an integer
KEYFRAME=24

# Bitrate in kilobites per second, NOT kilobytes, 1 kilobyte = 8 kilobits
BITRATE=1600

# Max bit rate
MAXRATE=2500

# Audio channels, use 1 for mono and 2 for stereo
AUDIO_CHANNELS=0

# Audio rate, Flash can handle up to 44100
AUDIO_RATE=44100

# Audio bitrate in kilobites
AUDIO_BITRATE=128

# ----------------------------------------------------------------------------
# WARNING!
# DONT TOUCH OR CHANGE NOTHING BELOW THIS LINE!
# ----------------------------------------------------------------------------

if [ -z "$1" ]
then
	echo
	echo  ERROR!
	echo  No input file specified.
	echo  You can an input by draggin a video file to this script or by calling 
	echo  the script on the command prompt and setting the full file path as 
	echo  the first param.
	echo
	sleep 5 
else

	# Input File:
	INPUT=$1
	
	# File paths
	I_PATH=${1%/*}
	I_FILE=${1##*/}
	BASE=${I_FILE%%.*}
	EXT=${I_FILE#*.}

	# Output
	OUTPUT_FILE_NAME_NOT_INJECTED=$I_PATH/$BASE.480pni.flv
	OUTPUT_FILE_NAME_INJECTED=$I_PATH/$BASE.480p.flv

	# Buffer size
	let BUFSIZE=$MAXRATE*2

	# Batch path
	THIS_PATH=${0%/*}/..

	# Bin path
	BIN_PATH=$THIS_PATH/bin

	# FFmpeg command
	echo First Pass Encoding.
	$BIN_PATH/ffmpeg -y -i $INPUT -threads 0 -s $SIZE -aspect $ASPECT -r $FRAME_RATE -b "$BITRATE"k -maxrate "$MAXRATE"k -bufsize "$BUFSIZE"k -vcodec libx264 -g $KEYFRAME -pass 1 -vpre $BIN_PATH/fastfirstpass.ffpreset -an -f rawvideo /dev/null
	echo Second Pass Encoding.
	$BIN_PATH/ffmpeg -y -i $INPUT -threads 0 -s $SIZE -aspect $ASPECT -r $FRAME_RATE -b "$BITRATE"k -maxrate "$MAXRATE"k -bufsize "$BUFSIZE"k -vcodec libx264 -g $KEYFRAME -pass 2 -vpre $BIN_PATH/hq.ffpreset -an $OUTPUT_FILE_NAME_NOT_INJECTED

	# Remove the logs
	echo Removing pass logs.
	rm ffmpeg2pass-0.log
	rm x264_2pass.log

	# inject the FLV video with metadata
	echo Injecting metadata
	$BIN_PATH/flvmeta $OUTPUT_FILE_NAME_NOT_INJECTED $OUTPUT_FILE_NAME_INJECTED && rm $OUTPUT_FILE_NAME_NOT_INJECTED
	echo Creation of $OUTPUT_FILE_NAME_INJECTED Done!

fi
Clone this wiki locally