Hey all, Beorn here, the animator dude who’s been roped into the thankless task of encoding the movie into various formats. (Actually I was crazy enough to volunteer!)

Fortunately the DivX files will be encoded by the good people at DivX, who are actual professionals (as opposed to a forum trawling script kiddie like me).

Despite what Ton has said on this blog before, this is not my area of expertise. I’m really learning as I go and would very much appreciate any advice from the community. I just thought I’d share my current progress and ask for any suggestions on how to improve things.

The goal:

To provide h264 quicktimes and ogg video files in 480p, 720p and 1080p, with subtitles and surround sound (except the 480p versions which will be stereo), and to encode the video for the dvds (NTSC and PAL versions).

I’ve been supplied:

directory of PNG files, 2048×872 in size

a stereo wav file

an audio only quicktime file with 5.1 sound in the aac codec. (there is also an ac3 file for the dvd)

a directory of subtitle files in .srt format

Please note: I’ve compiled my own versions of ffmpeg and x264 in order to make the quicktimes.

My current issues:

I haven’t been able to add 5.1 audio to the ogg files in any other codec than flac, which means the files are HUGE.

The ogg video files are about 3x bigger than the quicktimes, even with stereo sound

I haven’t been able to add subtitles to the quicktimes.

I’m using mplayer to do the scaling/cropping/letterboxing, but it keeps crashing on the 1080 versions when trying to crop on the fly. Notice the hack I’ve included on those versions; making cropped copies of the PNGs, encoding them and deleting them. It works, but it’s… inelegant.

Here are the shell scripts…

Ogg versions:

title="Sintel"

author="Durian Open Movie Team"

year="2010"

license="Creative Commons Attribution 3.0 license"

copyright="(c) Copyright 2010 Blender Foundation, all rights reserved"

description="Sintel open movie project"

au_stereo="input/audio/sintel-master-st.wav"

au_surround="input/audio/sintel-master-51.mov"



echo "********************"

echo "Ogging the audio"

echo "********************"

ffmpeg -i $au_stereo -acodec libvorbis -ab 448k -ac 2 output/ogg/tmp-audio-st.ogg

ffmpeg -i $au_surround -acodec flac -ac 6 -ab 128k output/ogg/tmp-audio-51.ogg

echo "********************"

echo "Ogging the subtitles"

echo "********************"

kateenc -t srt -l en -c SUB -o output/ogg/tmp-subs_en.ogg input/subtitles/sintel_en.srt

kateenc -t srt -l de -c SUB -o output/ogg/tmp-subs_de.ogg input/subtitles/sintel_de.srt

kateenc -t srt -l es -c SUB -o output/ogg/tmp-subs_es.ogg input/subtitles/sintel_es.srt

kateenc -t srt -l fr -c SUB -o output/ogg/tmp-subs_fr.ogg input/subtitles/sintel_fr.srt

kateenc -t srt -l nl -c SUB -o output/ogg/tmp-subs_nl.ogg input/subtitles/sintel_nl.srt

kateenc -t srt -l pl -c SUB -o output/ogg/tmp-subs_pl.ogg input/subtitles/sintel_pl.srt



echo "********************"

echo "Starting 480 ogg"

echo "********************"

rm output/ogg/stream.yuv

mkfifo output/ogg/stream.yuv &&

mplayer mf://input/png/*.png -mf w=2048:h=872:fps=24:type=png -sws 9 -vf expand=2048:1152,scale=854:480 -vo yuv4mpeg:file=output/ogg/stream.yuv&

ffmpeg2theora --keyint 24 --framerate 24 -v 8 output/ogg/stream.yuv --title "$title" --artist "$author" --copyright "$copyright" --license "$license" -o output/ogg/tmp-480.ogv

oggz-merge output/ogg/tmp-480.ogv output/ogg/tmp-audio-st.ogg output/ogg/tmp-subs_en.ogg output/ogg/tmp-subs_de.ogg output/ogg/tmp-subs_es.ogg output/ogg/tmp-subs_fr.ogg output/ogg/tmp-subs_nl.ogg output/ogg/tmp-subs_pl.ogg -o output/ogg/sintel-480p.ogv

rm output/ogg/stream.yuv

echo "********************"

echo "Starting 720 ogg"

echo "********************"

rm output/ogg/stream.yuv

mkfifo output/ogg/stream.yuv &&

mplayer mf://input/png/*.png -mf w=2048:h=872:fps=24:type=png -sws 9 -vf expand=2048:1152,scale=1280:720 -vo yuv4mpeg:file=output/ogg/stream.yuv&

ffmpeg2theora --keyint 24 --framerate 24 -v 8 output/ogg/stream.yuv --title "$title" --artist "$author" --copyright "$copyright" --license "$license" -o output/ogg/tmp-720.ogv

oggz-merge output/ogg/tmp-720.ogv output/ogg/tmp-audio-st.ogg output/ogg/tmp-subs_en.ogg output/ogg/tmp-subs_de.ogg output/ogg/tmp-subs_es.ogg output/ogg/tmp-subs_fr.ogg output/ogg/tmp-subs_nl.ogg output/ogg/tmp-subs_pl.ogg -o output/ogg/sintel-720p.ogv

rm output/ogg/stream.yuv

echo "********************"

echo "Starting 1080 ogg"

echo "********************"

cd tmp

mplayer mf://../input/png/*.png -mf w=2048:h=872:fps=24:type=png -sws 9 -vf expand=2048:1080,crop=1920:1080 -vo png:z=3

cd ..

ffmpeg2theora --keyint 24 --framerate 24 -v 8 tmp/%08d.png --title "$title" --artist "$author" --copyright "$copyright" --license "$license" -o output/ogg/tmp-1080.ogv

oggz-merge output/ogg/tmp-1080.ogv output/ogg/tmp-audio-51.ogg output/ogg/tmp-subs_en.ogg output/ogg/tmp-subs_de.ogg output/ogg/tmp-subs_es.ogg output/ogg/tmp-subs_fr.ogg output/ogg/tmp-subs_nl.ogg output/ogg/tmp-subs_pl.ogg -o output/ogg/sintel-1080p.ogv

rm tmp/*.png

rm output/ogg/tmp*.*

echo "Ogg versions encoded"

H264/AAC Quicktimes:

title="Sintel"

author="Durian Open Movie Team"

year="2010"

copyright="(c) Copyright 2010 Blender Foundation, all rights reserved"

license="Creative Commons Attribution 3.0 license"

description="Sintel open movie project"

au_stereo="input/audio/sintel-master-st.wav"

au_surround="input/audio/sintel-master-51.mov"



echo "********************"

echo "Starting 480 quicktime"

echo "********************"

rm output/h264/stream.yuv

mkfifo output/h264/stream.yuv &&

mplayer mf://input/png/*.png -mf w=2048:h=872:fps=24:type=png -sws 9 -vf expand=2048:1152,scale=854:480 -vo yuv4mpeg:file=output/h264/stream.yuv&

ffmpeg -y -f yuv4mpegpipe -i output/h264/stream.yuv -i $au_stereo -acodec libfaac -ab 448k -ac 2 -vcodec libx264 -vpre slow -crf 22 -threads 8 -metadata title="$title" -metadata author="$author" -metadata year="$year" -metadata copyright="$copyright" -metadata license="$license" -metadata description="$description" output/h264/sintel-480p.mov

rm output/h264/stream.yuv

echo "********************"

echo "Starting 720 quicktime"

echo "********************"

rm output/h264/stream.yuv

mkfifo output/h264/stream.yuv &&

mplayer mf://input/png/*.png -mf w=2048:h=872:fps=24:type=png -sws 9 -vf expand=2048:1152,scale=1280:720 -vo yuv4mpeg:file=output/h264/stream.yuv&

ffmpeg -y -f yuv4mpegpipe -i output/h264/stream.yuv -i $au_surround -acodec copy -vcodec libx264 -vpre slow -crf 22 -threads 8 -metadata title="$title" -metadata author="$author" -metadata year="$year" -metadata copyright="$copyright" -metadata license="$license" -metadata description="$description" output/h264/sintel-720p.mov

rm output/h264/stream.yuv

echo "********************"

echo "Starting 1080 quicktime"

echo "********************"

cd tmp

mplayer mf://../input/png/*.png -mf w=2048:h=872:fps=24:type=png -sws 9 -vf expand=2048:1080,crop=1920:1080 -vo png:z=3

cd ..

ffmpeg -y -r 24 -i tmp/%08d.png -i $au_surround -acodec copy -vcodec libx264 -vpre slow -crf 22 -threads 8 -metadata title="$title" -metadata author="$author" -metadata year="$year" -metadata copyright="$copyright" -metadata license="$license" -metadata description="$description" output/h264/sintel-1080p.mov

rm tmp/*.png

echo "Quicktimes encoded"

DVD versions:



# NTSC version

mencoder mf://input/png/*.png -mf w=2048:h=872:fps=24:type=png -sws 9 -vf expand=2048:1152,scale=720:480 -oac lavc -ovc lavc -ss 0 -endpos 883 -mpegopts format=dvd:tsaf -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:aspect=16/9:vrc_maxrate=9800:vbitrate=4400:keyint=15:acodec=ac3:abitrate=192 -srate 48000 -ofps 30000/1001 -of mpeg -mc 0 -noskip -o "output/dvd/sintel-ntsc_noaudio.mp2"

echo "NTSC-DVD files encoded"

# PAL version

mencoder mf://input/png/*.png -mf w=2048:h=872:fps=24:type=png -sws 9 -vf expand=2048:1152,scale=720:576 -oac lavc -ovc lavc -ss 0 -endpos 883 -mpegopts format=dvd:tsaf -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:aspect=16/9:vrc_maxrate=9800:vbitrate=4400:keyint=15:acodec=ac3:abitrate=192 -srate 48000 -ofps 25/1 -of mpeg -mc 0 -noskip -o "output/dvd/sintel-pal_noaudio.mpeg2"

echo "PAL-DVD files encoded"

Please try to limit comments to those that are actually useful to this process.

Also, please do not ask us to send you the files to encode yourself. After the premiere, all can be released.

Cheers,

Beorn