t_fischer: (cat face)
[personal profile] t_fischer

Think of the situation, where you created a presentation or a lecture consisting of a set of slides. Now, imagine that part of you audience cannot attend, as your presentation is at a remote conference or you are teacher in a distance education course having students all over the world.

There exist commercial solutions, where you can record you presentation slides along with commentary speech, but cannot you achieve the same result using free tools?

The answer is "Yes", as I will explain in this posting.

To follow this posting, you have to have the following prerequisits:

  1. Your presentation as a PDF file
  2. A microphone to record you own voice including software to record (e.g. Audacity or arecord)
  3. A recent Linux distribution or a comparable system with GhostScript, ImageMagick, FFmpeg, and Mencoder installed

The first step is to record single .wav files for each of your slides. As each slide will be shown for the duration of its audio recording, feel free to include silent pauses. Once you are satisfied with your recording, save each page's recoding in a filename like this: For the first slide page001.wav, for the secod slide page002.wav, ...

If you want to use Alsa's command line tool, use arecord -l to probe which recoding devices are available. The actual recording command may look like this arecord -D hw:1,0 -f dat -c 1 -r 22050 page003.wav. Press Ctrl+C to stop the recording.

Next, copy the script from below and your PDF file in the same directory where you stored the audio recordings. The script will use GhostScript to generate images from each page in the presentation, generate short movie clips for each page combining your audio recording and the image, and finally join all movie clips into one large file.

Save the script as makemovie.sh and run it via bash makemovie.sh PRESENTATION.pdf.

#!/bin/sh

pdffilename="$1"
joinedavifilename="${pdffilename/.pdf/.avi}"
if [ -z "${pdffilename}" ] ; then
	echo "You have to provide a PDF file as parameter" >&2
	exit 1
fi
if [[ ! -s "${pdffilename}" || ! -f "${pdffilename}" ]] ; then
	echo "The provided filename does not exist" >&2
	exit 1
fi
if [[ "${joinedavifilename}" = "${pdffilename}" ]] ; then
	echo "The provided filename does not end with .pdf" >&2
	exit 1
fi

for n in $(seq -f "%03.0f" 1 999) ; do
	avifilename="page${n}.avi"
	pngfilename="page${n}.png"
	wavfilename="page${n}.wav"
	if [ ! -f ${wavfilename} ] ; then continue ; fi

	echo "=== Slide $n ====================================="

	if [[ ! -s ${pngfilename} || ${pdffilename} -nt ${pngfilename} ]] ; then
		gs -sDEVICE=png16m -r512 -dSAFER -dNOPAUSE  -dFirstPage=${n} -dLastPage=${n} -sOutputFile=temp.png -dBATCH "${pdffilename}" || exit 2
		convert -scale 768x576 temp.png ${pngfilename}
		rm -f temp.png
	fi

	if [[ ! -s ${avifilename} || ${pngfilename} -nt ${avifilename} || ${wavfilename} -nt ${avifilename} ]] ; then
		rm -f ${avifilename}
		ffmpeg -loop_input -r 3 -shortest -i ${pngfilename} -i ${wavfilename} -aspect 4:3 -acodec libmp3lame -ab 96k -vcodec libx264 -vpre ultrafast ${avifilename} || exit 3
	fi
done

rm -f "${joinedavifilename}"
mencoder -forceidx -oac copy -ovc copy -o "${joinedavifilename}" page*.avi || exit 4

ls -l "${joinedavifilename}"
file "${joinedavifilename}"

From:
Anonymous
OpenID
Identity URL: 
User
Account name:
Password:
If you don't have an account you can create one now.
Subject:
HTML doesn't work in the subject.

Message:

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org


 
Notice: This account is set to log the IP addresses of everyone who comments.
Links will be displayed as unclickable URLs to help prevent spam.

Profile

t_fischer: (Default)
Thomas Fischer

March 2017

S M T W T F S
   1234
567891011
12131415161718
19202122232425
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags