SpinOneSolutions | I waste my time so that you don’t have to…

Apr/10

5

PS3 H264/AAC 5.1 Encoding with FFmpeg

The Problem:

You want to encode video for playback on a PS3 using FFmpeg.

The Solution:

I’ve got a working command line option for you right here.  This is a solution, not the only solution.

My Setup:
Ubuntu 9.10 (Karmic)
libx264 (for encoding H264)
libfaac (for encoding AAC)
mkvtoolnix
ffmpeg
fuppes

I’m also going to assume that your input file is a .mkv containing an H264 video track and an AC-3 audio track.  Most of the time this is fair assumption however, it won’t be correct 100% of the time.

To start, you’re going to need a current build of FFmpeg. It’s been a while since I did the build but I think these were my configuration options.

#cd ~/ffmpeg #make distclean
#svn update #sudo ./configure \
--enable-gpl \
--enable-nonfree \
--enable-postproc \
--enable-pthreads \
--enable-x11grab \
--enable-runtime-cpudetect \
--enable-libdc1394 \
--enable-libfaac \
--enable-libfaad \
--enable-libgsm \
--enable-libmp3lame \
--enable-libtheora \
--enable-libvorbis \
--enable-libx264 \
--enable-libxvid \
--arch=x86_64
#make #sudo checkinstall \
--ftrans=no \
--install=yes \
--pkgname=ffmpeg \
--pkversion "4:0.5.svn'date + %Y%m%d'-12ubuntu3" \
--default

On to what you REALLY wanted to know, here’s my command sequence.

#mkvextract tracks {input-file}.mkv 1:video.h264
#mkvextract tracks {input-file}.mkv 2:audio.ac3
#ffmpeg -i video.h264 -i audio.ac3 \
-vcodec copy \
-acodec libfaac -ab 320k -ac 6 \
-threads 0 -f mp4 \
{output-file-name}.mp4

Let’s break it down line by line so that you can modify it to your needs:
mkvextract tracks {input-file}.mkv 1:video.h264

Extract track 1 to “video.h264″

mkvextract tracks {input-file}.mkv 2:audio.ac3

Extract track 2 to “audio.ac3″

ffmpeg -i video.h264 -i audio.ac3

Input video.h264
Input audio.ac3

-vcodec copy

Copy the video track as is.

-acodec libfaac -ab 320k -ac 6

Transform audio track to AAC using libfaac
Set Audio Bitrate to 320k
Set Audio Channels to 6 (5.1)

-threads 0 -f mp4

Let ffmpeg decide how many threads to use
Set the container format to mp4

{output-file-name}.mp4

Output the file as specified

Checkout the ffmpeg documentation for more information about general options.

I donno about you, but I got tired of typing out three commands for every file I wanted to encode, plus all those options… forget about it!  So I wrote a stupid little shell script to do it for me.

You can download it here: ps3encode.  Just plop it somewhere in your filesystem and then make sure it’s included in your PATH variable and that it has execute permissions.

Usage:

#ps3encode {input-file}.mkv {output-file}.mp4

Questions and comments welcome!

Be Sociable, Share!

RSS Feed

1 Comment for PS3 H264/AAC 5.1 Encoding with FFmpeg

fossil 財布 メンズ | December 1, 2013 at 6:03 am

鞄 革 ブランド fossil 財布 メンズ http://qingbianoy.breitlingcarrier2013.com/

Leave a comment!

«

»

Find it!

Theme Design by devolux.org