Browse Source

add support for mp4 file format... this includes aac audio which

supports multi channel..

[git-p4: depot-paths = "//depot/": change = 1416]
main
John-Mark Gurney 15 years ago
parent
commit
c56164bff8
2 changed files with 22 additions and 9 deletions
  1. +20
    -9
      FSStorage.py
  2. +2
    -0
      README

+ 20
- 9
FSStorage.py View File

@@ -4,6 +4,7 @@
__version__ = '$Change$' __version__ = '$Change$'
# $Id$ # $Id$


ffmpeg_path = '/a/home/jmg/src/ffmpeg/ffmpeg'
ffmpeg_path = '/usr/local/bin/ffmpeg' ffmpeg_path = '/usr/local/bin/ffmpeg'


import FileDIDL import FileDIDL
@@ -130,29 +131,39 @@ class DynamTransfer(protocol.ProcessProtocol):
path = self.path path = self.path
request = self.request request = self.request


mimetype = { 'xvid': 'video/x-msvideo',
'mpeg2': 'video/mpeg',
'mp4': 'video/mp4',
}

vcodec = mods[0] vcodec = mods[0]
if mods[0] not in ('xvid', 'mpeg2', ):
vcodec = 'xvid'
if mods[0] not in mimetype:
vcodec = 'mp4'


mimetype = { 'xvid': 'video/avi', 'mpeg2': 'video/mpeg', }
mimetype = { 'xvid': 'video/x-msvideo', 'mpeg2': 'video/mpeg', }
request.setHeader('content-type', mimetype[vcodec]) request.setHeader('content-type', mimetype[vcodec])
if request.method == 'HEAD': if request.method == 'HEAD':
return '' return ''


audiomp3 = [ '-acodec', 'mp3', '-ab', '192', ]
audiomp2 = [ '-acodec', 'mp2', '-ab', '256', ]
audiomp3 = [ '-acodec', 'mp3', '-ab', '192k', '-ac', '2', ]
audiomp2 = [ '-acodec', 'mp2', '-ab', '256k', '-ac', '2', ]
audioac3 = [ '-acodec', 'ac3', '-ab', '640k', ]
audioaac = [ '-acodec', 'aac', '-ab', '640k', ]
optdict = { optdict = {
'xvid': [ '-vcodec', 'xvid', 'xvid': [ '-vcodec', 'xvid',
#'-mv4', '-gmc', '-g', '240', #'-mv4', '-gmc', '-g', '240',
'-f', 'avi', ] + audiomp3, '-f', 'avi', ] + audiomp3,
'mpeg2': [ '-vcodec', 'mpeg2video', #'-g', '60', 'mpeg2': [ '-vcodec', 'mpeg2video', #'-g', '60',
'-f', 'mpeg', ] + audiomp2,
'-f', 'mpegts', ] + audioac3,
'mp4': [ '-vcodec', 'libx264', #'-g', '60',
'-f', 'mpegts', ] + audioaac,
} }
args = [ 'ffmpeg', '-i', path, '-b', '4000',
args = [ 'ffmpeg', '-i', path,
'-sameq',
'-threads', '4',
#'-vb', '8000k',
#'-sc_threshold', '500000', '-b_strategy', '1', '-max_b_frames', '6', #'-sc_threshold', '500000', '-b_strategy', '1', '-max_b_frames', '6',
] + optdict[vcodec] + [ '-', ] ] + optdict[vcodec] + [ '-', ]
#log.msg(*[`i` for i in args])
log.msg(*[`i` for i in args])
self.proc = process.Process(reactor, ffmpeg_path, args, self.proc = process.Process(reactor, ffmpeg_path, args,
None, None, self) None, None, self)
self.proc.closeStdin() self.proc.closeStdin()


+ 2
- 0
README View File

@@ -79,6 +79,8 @@ Ideas for future improvements:
drop them? How do we detect them to prevent blocking other clients. drop them? How do we detect them to prevent blocking other clients.
Add support to call Browse in a thread. Convert Browse to be a Add support to call Browse in a thread. Convert Browse to be a
deferredGenerator so we can deferredGenerator so we can
Support transcoding to mp4 format, video will be h.264 and audio will
be AAC.


v0.x: v0.x:
Ignore AppleDouble Resource Fork Files. (Maybe we should ignore all Ignore AppleDouble Resource Fork Files. (Maybe we should ignore all


Loading…
Cancel
Save