All posts in “ffmpeg”

How to use format your videos to play on DirecTV Media Share with XBMC

I recently upgraded to DirecTV with the whole house dvr and noticed they have a media share feature.   I have XBMC running on my Android STB which works well but I can only watch my movies on the TV it is plugged into or on Smart TVs with DNLA support.    With the DirecTV receivers I can now have the ability to stream movies to all my tvs.

After testing it out, I found that the media share has very limited support for what types of files are supported.  I found I got the best results with the following format

Video: MPEG-2 TS

Audio: MP3 Stereo

PART I: Encode to MPEG-2

Now that I figured out the supported format, I set out to find the easiest way to convert my DVD and existing files to the compatible format.   I have been using HandBrake (http://www.handbrake.fr) for quite a while and really like  the simplicity of it.  I am using version 0.9.9   The previous versions have an error when performing 2 pass encoding, so you will want to make sure you are using this version or later.

The first thing is to select your video source by either adding a DVD folder or Video File.   After adding the file, choose the destination and  for Container choose MKV file.

For picture, I just leave the default settings.

HandBrake Video Settings

Filters leave everything set to off unless you have a reason to apply a filter such as Deinterlace

HandBrake Picture settings

On the Video tab, these settings are very important.

  • Set the Codec to MPEG-2(FFmpeg)
  • Quality choose Avg Bitrate and set to 2500
  • Check 2-Pass Encoding

HandBrake Video Settings

On the Audio tab choose MP3 for the codec and change Mixdown to Stereo HandBrake Filters Settings

Skip the subtitles tab.   Uncheck Create chapter markers on the Chapters tab.  Don’t change anything on the Advanced Tab.

Once you have these settings click Encode to start the encoding.

PART II: Change container from mkv to mpg

Once Handbrake is finished, you will have an mkv file.  You can test the file with VLC Media Player if you want, but MEDIA SHARE won’t recognize the file because it needs to be a MPEG-2 TS file.     For this you will need to download FFmpeg.     You can find download links here http://www.ffmpeg.org/download.html

After downloading the file you will want to change the container with the following command parameters
-y -i inputmovie.mkv -f mpegts -vcodec copy -acodec copy outputmovie.mpg

On windows you can create a bat file with the following

SET FFMPEG="D:\Downloads\ffmpeg-20130602-git-5711e4f-win64-static\bin\ffmpeg.exe"

SET OUTPUT_PATH=D:\Stuff\MediaShare\NEW

SET FILENAME=%~n1 SET OUTPUT_FILE=%OUTPUT_PATH%\%FILENAME%.mpg

%FFMPEG% -y -i %1 -f mpegts -vcodec copy -acodec copy "%OUTPUT_FILE%"

You can then set handbrake to run the bat file when finished processing by going to Tools->Options->General and browsing to the batch file that you just created for “Send file to:”