forked from 0x2620/pandora
check for avconv version and use new command line api if needed (to support Ubuntu 14.04)
This commit is contained in:
parent
f433495592
commit
f0a5f5ddb7
3 changed files with 35 additions and 19 deletions
|
@ -16,7 +16,7 @@ from django.contrib.auth.models import User
|
||||||
import ox.jsonc
|
import ox.jsonc
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
|
|
||||||
from archive.extract import supported_formats, AVCONV
|
from archive.extract import supported_formats, AVCONV, avconv_version
|
||||||
from item.utils import get_by_id
|
from item.utils import get_by_id
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,6 +142,7 @@ check the README for further details.
|
||||||
|
|
||||||
''' % AVCONV)
|
''' % AVCONV)
|
||||||
|
|
||||||
|
settings.AVCONV_VERSION = avconv_version()
|
||||||
settings.CONFIG = config
|
settings.CONFIG = config
|
||||||
admin = len(settings.CONFIG['userLevels']) - 1
|
admin = len(settings.CONFIG['userLevels']) - 1
|
||||||
if not 'syncdb' in sys.argv \
|
if not 'syncdb' in sys.argv \
|
||||||
|
|
|
@ -62,6 +62,13 @@ def supported_formats():
|
||||||
'mp4': 'libx264' in stdout and 'libvo_aacenc' in stdout,
|
'mp4': 'libx264' in stdout and 'libvo_aacenc' in stdout,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def avconv_version():
|
||||||
|
p = subprocess.Popen([AVCONV],
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
stdout, stderr = p.communicate()
|
||||||
|
version = stderr.split(' ')[2].split('-')[0]
|
||||||
|
return version
|
||||||
|
|
||||||
def stream(video, target, profile, info, avconv=None):
|
def stream(video, target, profile, info, avconv=None):
|
||||||
if not os.path.exists(target):
|
if not os.path.exists(target):
|
||||||
ox.makedirs(os.path.dirname(target))
|
ox.makedirs(os.path.dirname(target))
|
||||||
|
@ -198,6 +205,13 @@ def stream(video, target, profile, info, avconv=None):
|
||||||
'-qdiff', '4'
|
'-qdiff', '4'
|
||||||
]
|
]
|
||||||
'''
|
'''
|
||||||
|
if settings.AVCONV_VERSION >= '9':
|
||||||
|
video_settings += [
|
||||||
|
'-vcodec', 'libx264',
|
||||||
|
'-preset:v', 'medium',
|
||||||
|
'-profile:v', 'baseline',
|
||||||
|
]
|
||||||
|
else:
|
||||||
video_settings += [
|
video_settings += [
|
||||||
'-vcodec', 'libx264',
|
'-vcodec', 'libx264',
|
||||||
'-flags', '+loop+mv4',
|
'-flags', '+loop+mv4',
|
||||||
|
|
|
@ -151,6 +151,7 @@ LOGGING = {
|
||||||
|
|
||||||
AUTH_PROFILE_MODULE = 'user.UserProfile'
|
AUTH_PROFILE_MODULE = 'user.UserProfile'
|
||||||
AUTH_CHECK_USERNAME = True
|
AUTH_CHECK_USERNAME = True
|
||||||
|
AVCONV_VERSION = 0
|
||||||
|
|
||||||
#=========================================================================
|
#=========================================================================
|
||||||
#Pan.do/ra related settings settings
|
#Pan.do/ra related settings settings
|
||||||
|
|
Loading…
Reference in a new issue