Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Adding h264 support to PhotoFilmStrip
These two small changes worked for me to get h264 support. I also set the BitRate value in settings dialog to only 4000 as the default 12000 gives very large files. The options passed to Mencoder here are probably not perfect. They cause warnings in the err log file but the resulting video files have been working fine for me in XBMC. See my blog post at neocogent.com for more description and also generating filmstrip control parms programatically using SQL queries.
Insert this class into file /usr/lib/python2.7/dist-packages/photofilmstrip/core/renderer/MovieRenderer.py (right after the MPEG4AC3Renderer class is good).
class H264AVCRenderer(MEncoderRenderer):
def __init__(self):
MEncoderRenderer.__init__(self)
@staticmethod
def GetName():
return _(u"MPEG4-H264/AVC (MP4)")
@staticmethod
def GetProperties():
return MEncoderRenderer.GetProperties()
@staticmethod
def GetDefaultProperty(prop):
return MEncoderRenderer.GetDefaultProperty(prop)
def _GetCmd(self):
cmd = ["mencoder", "-demuxer", "lavf", "-fps", "25", "-lavfdopts", "format=mjpeg"]
cmd += self._GetAudioArgs()
cmd += self._GetSubArgs()
cmd += ["-ovc", "x264",
"-x264encopts", "bitrate=%d" % self._GetBitrate(),
"-ofps", self._GetFrameRate(),
"-of", "lavf=yes", "-lavfopts", "format=mp4",
"-oac", "copy",
"-o", os.path.join(self.GetOutputPath(), "output.mp4"),
"-"]
return cmd
And alter RENDERERS and MovieRenderer (import) in the __init__.py file (same directory) to have the H264AVCRenderer in both lists.
eg.
from photofilmstrip.core.renderer.MovieRenderer import (
MPEGRenderer,
MPEG4MP3Renderer,
MPEG4AC3Renderer,
H264AVCRenderer,
FlashMovieRenderer,
MJPEGRenderer)
RENDERERS = [SingleFileRenderer,
MPEG4MP3Renderer,
MPEG4AC3Renderer,
H264AVCRenderer,
MPEGRenderer,
FlashMovieRenderer,
MJPEGRenderer,
PyGameRenderer,
CairoRenderer]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.