reformat ffmpeg calls
This commit is contained in:
parent
b9ac31aee0
commit
64c35cf502
2 changed files with 16 additions and 13 deletions
|
@ -6,11 +6,13 @@ from config import Config
|
||||||
|
|
||||||
|
|
||||||
def generate_test_file(fn, delta):
|
def generate_test_file(fn, delta):
|
||||||
subprocess.call(['ffmpeg',
|
subprocess.call([
|
||||||
'-f', 'lavfi',
|
'ffmpeg',
|
||||||
'-i', 'sine=frequency=1000:duration=%d' % delta.total_seconds(),
|
'-f', 'lavfi',
|
||||||
'-b:a', '%dk' % Config.KBITS,
|
'-i', 'sine=frequency=1000:duration=%d' % delta.total_seconds(),
|
||||||
fn])
|
'-b:a', '%dk' % Config.KBITS,
|
||||||
|
fn
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
start = datetime.now().replace(minute=0, second=0) - timedelta(hours=3)
|
start = datetime.now().replace(minute=0, second=0) - timedelta(hours=3)
|
||||||
|
|
|
@ -110,14 +110,15 @@ def prepare_download(form):
|
||||||
output_filename = os.path.basename(output_filename)
|
output_filename = os.path.basename(output_filename)
|
||||||
attachment_filename = '{}_{}.mp3'.format(form.start_time.data, form.length.data)
|
attachment_filename = '{}_{}.mp3'.format(form.start_time.data, form.length.data)
|
||||||
|
|
||||||
c = ['ffmpeg', '-y']
|
c = [
|
||||||
c += ['-ss', str(ss)]
|
'ffmpeg', '-y',
|
||||||
c += ['-i', 'concat:' + '|'.join(
|
'-ss', str(ss),
|
||||||
[os.path.join(app.config['DATA_DIR'], s['fn']) for s in sources])]
|
'-i', 'concat:' + '|'.join(
|
||||||
c += ['-codec', 'copy']
|
[os.path.join(app.config['DATA_DIR'], s['fn']) for s in sources]),
|
||||||
c += ['-t', str(form.length.data * 60)]
|
'-codec', 'copy',
|
||||||
c += [os.path.join(app.config['TMP_DIR'], output_filename)]
|
'-t', str(form.length.data * 60),
|
||||||
|
os.path.join(app.config['TMP_DIR'], output_filename)
|
||||||
|
]
|
||||||
app.logger.debug(' '.join(c))
|
app.logger.debug(' '.join(c))
|
||||||
subprocess.call(c)
|
subprocess.call(c)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue