Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ffmpeg.py: take out the general parts of the functions #2981

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions src/you_get/processor/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ def ffmpeg_concat_ts_to_mkv(files, output='output.mkv'):
except:
return False

def ffmpeg_concat_flv_to_mp4(files, output='output.mp4'):
print('Merging video parts... ', end="", flush=True)
# Use concat demuxer on FFmpeg >= 1.1
def ffmpeg_concat_demuxer(files, output='output.mp4'):
if FFMPEG == 'ffmpeg' and (FFMPEG_VERSION[0] >= 2 or (FFMPEG_VERSION[0] == 1 and FFMPEG_VERSION[1] >= 1)):
concat_list = generate_concat_list(files, output)
params = [FFMPEG] + LOGLEVEL + ['-y', '-f', 'concat', '-safe', '0',
Expand All @@ -157,6 +155,12 @@ def ffmpeg_concat_flv_to_mp4(files, output='output.mp4'):
os.remove(output + '.txt')
return True

def ffmpeg_concat_flv_to_mp4(files, output='output.mp4'):
print('Merging video parts... ', end="", flush=True)
# Use concat demuxer on FFmpeg >= 1.1
if ffmpeg_concat_demuxer(files, output):
return True

for file in files:
if os.path.isfile(file):
params = [FFMPEG] + LOGLEVEL + ['-y', '-i']
Expand Down Expand Up @@ -201,14 +205,7 @@ def ffmpeg_concat_mp3_to_mp3(files, output='output.mp3'):
def ffmpeg_concat_mp4_to_mp4(files, output='output.mp4'):
print('Merging video parts... ', end="", flush=True)
# Use concat demuxer on FFmpeg >= 1.1
if FFMPEG == 'ffmpeg' and (FFMPEG_VERSION[0] >= 2 or (FFMPEG_VERSION[0] == 1 and FFMPEG_VERSION[1] >= 1)):
concat_list = generate_concat_list(files, output)
params = [FFMPEG] + LOGLEVEL + ['-y', '-f', 'concat', '-safe', '0',
'-i', concat_list, '-c', 'copy',
'-bsf:a', 'aac_adtstoasc']
params.extend(['--', output])
subprocess.check_call(params, stdin=STDIN)
os.remove(output + '.txt')
if ffmpeg_concat_demuxer(files, output):
return True

for file in files:
Expand Down