- implemented --ffmpeg-vfilter: Raw ffmpeg -filter:v options, e.g. "scale=1280:-1"
- bugfixes
This commit is contained in:
parent
691244db41
commit
0fb3276b9f
1 changed files with 17 additions and 8 deletions
|
@ -17,15 +17,16 @@ from aux import Command, parse_fps
|
||||||
prefix = over.core.textui.prefix
|
prefix = over.core.textui.prefix
|
||||||
_print = over.core.textui.Output('over.video')
|
_print = over.core.textui.Output('over.video')
|
||||||
|
|
||||||
# --------------------------------------------------
|
# -------------------------------------------------- TODO Raw -filter:v interface for resizing and so on
|
||||||
|
|
||||||
command = over.core.types.ndict()
|
command = over.core.types.ndict()
|
||||||
command.identify = Command('ffprobe', '-v', 'quiet', '-print_format', 'json', '-show_format', '-show_streams', 'INFILE')
|
command.identify = Command('ffprobe', '-v', 'quiet', '-print_format', 'json', '-show_format', '-show_streams', 'INFILE')
|
||||||
command.normalize_prepass = Command('ffmpeg', '-i', 'INFILE', '-af', 'volumedetect', '-f', 'null', '/dev/null')
|
command.normalize_prepass = Command('ffmpeg', '-i', 'INFILE', '-af', 'volumedetect', '-f', 'null', '/dev/null')
|
||||||
command.encode_theora = Command('ffmpeg', '-i', 'INFILE', '-codec:v', 'libtheora', '-qscale:v', 'VQ', '-codec:a', 'libvorbis', '-qscale:a', 'AQ', 'NORMALIZE', 'OUTFILE')
|
command.encode_theora = Command('ffmpeg', '-i', 'INFILE', '-codec:v', 'libtheora', '-qscale:v', 'VQ', 'VFILTER', '-codec:a', 'libvorbis', '-qscale:a', 'AQ', 'NORMALIZE', 'OUTFILE')
|
||||||
command.encode_x264 = Command('ffmpeg', '-i', 'INFILE', '-c:v', 'libx264', '-preset', 'slow', '-crf', 'VQ', '-profile:v', 'high', '-level', '4.2', '-codec:a', 'libvorbis', '-qscale:a', 'AQ', 'NORMALIZE', 'OUTFILE')
|
command.encode_x264 = Command('ffmpeg', '-i', 'INFILE', '-c:v', 'libx264', '-preset', 'slow', '-crf', 'VQ', '-profile:v', 'high', '-level', '4.2', 'VFILTER', '-codec:a', 'libvorbis', '-qscale:a', 'AQ', 'NORMALIZE', 'OUTFILE')
|
||||||
command.encode_wav = Command('ffmpeg', '-i', 'INFILE', '-codec:a', 'pcm_s16le', 'NORMALIZE', 'OUTFILE')
|
command.encode_wav = Command('ffmpeg', '-i', 'INFILE', '-codec:a', 'pcm_s16le', 'NORMALIZE', 'OUTFILE')
|
||||||
command.normalize = Command('-filter:a', 'VOLUME')
|
command.normalize = Command('-filter:a', 'VOLUME')
|
||||||
|
command.vfilter = Command('-filter:v', 'ARGS')
|
||||||
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ if __name__ == '__main__':
|
||||||
main.add_option('audio-quality', 'float', 2, 'Audio encoding quality with -1 being the worst and 10 being the best.', short_name='a')
|
main.add_option('audio-quality', 'float', 2, 'Audio encoding quality with -1 being the worst and 10 being the best.', short_name='a')
|
||||||
main.add_option('normalize', 'bool', True, 'Normalize the audio track.', short_name='N')
|
main.add_option('normalize', 'bool', True, 'Normalize the audio track.', short_name='N')
|
||||||
main.add_option('normalize-target', 'float', -20.0, 'Target mean volume to target.', short_name='n')
|
main.add_option('normalize-target', 'float', -20.0, 'Target mean volume to target.', short_name='n')
|
||||||
|
main.add_option('ffmpeg-vfilter', 'str', "", 'Raw ffmpeg -filter:v options, e.g. "scale=1280:-1"', short_name='f')
|
||||||
main.add_option('move-source', 'str', '', 'Move source file to this directory after conversion.', short_name='m')
|
main.add_option('move-source', 'str', '', 'Move source file to this directory after conversion.', short_name='m')
|
||||||
main.add_option('dump-commands', 'bool', False, 'Print ffmpeg commands that would be executed. Implies §B--no-§garmed§/. If §B--§gnormalize§/ is in effect, the normalization pre-pass will still be performed so that the proper volume correction can be computed.', short_name='D')
|
main.add_option('dump-commands', 'bool', False, 'Print ffmpeg commands that would be executed. Implies §B--no-§garmed§/. If §B--§gnormalize§/ is in effect, the normalization pre-pass will still be performed so that the proper volume correction can be computed.', short_name='D')
|
||||||
main.add_option('armed', 'bool', False, 'Perform the suggested action.', short_name='A', use_cfg_file=False)
|
main.add_option('armed', 'bool', False, 'Perform the suggested action.', short_name='A', use_cfg_file=False)
|
||||||
|
@ -92,7 +94,7 @@ if __name__ == '__main__':
|
||||||
info.audio_codec = audio['codec_name']
|
info.audio_codec = audio['codec_name']
|
||||||
info.audio_channels = audio['channels']
|
info.audio_channels = audio['channels']
|
||||||
info.audio_samplerate = over.core.textui.Unit(audio['sample_rate'], 'Hz')
|
info.audio_samplerate = over.core.textui.Unit(audio['sample_rate'], 'Hz')
|
||||||
info.audio_language = audio['tags']['language'] if 'language' in audio['tags'] else 'und'
|
info.audio_language = audio['tags']['language'] if 'tags' in audio and 'language' in audio['tags'] else 'und'
|
||||||
info.audio_bitrate = over.core.textui.Unit(audio['bit_rate'], 'b/s') if 'bit_rate' in audio else "§r??§/"
|
info.audio_bitrate = over.core.textui.Unit(audio['bit_rate'], 'b/s') if 'bit_rate' in audio else "§r??§/"
|
||||||
|
|
||||||
_print('§mvideo§/: size=§b%d§/x§b%d§/ px, framerate=%s, codec=%s, bitrate=%s' %(info.video_size_x, info.video_size_y, info.video_fps, info.video_codec, info.video_bitrate))
|
_print('§mvideo§/: size=§b%d§/x§b%d§/ px, framerate=%s, codec=%s, bitrate=%s' %(info.video_size_x, info.video_size_y, info.video_fps, info.video_codec, info.video_bitrate))
|
||||||
|
@ -165,6 +167,13 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
encode_cmd.NORMALIZE = None
|
encode_cmd.NORMALIZE = None
|
||||||
|
|
||||||
|
if main.cfg.ffmpeg_vfilter:
|
||||||
|
command.vfilter.reset()
|
||||||
|
command.vfilter.ARGS = main.cfg.ffmpeg_vfilter.split()
|
||||||
|
encode_cmd.VFILTER = command.vfilter
|
||||||
|
else:
|
||||||
|
encode_cmd.VFILTER = None
|
||||||
|
|
||||||
if main.cfg.dump_commands:
|
if main.cfg.dump_commands:
|
||||||
_print('will execute §B%s§/' %(' '.join(encode_cmd.dump())), prefix.start)
|
_print('will execute §B%s§/' %(' '.join(encode_cmd.dump())), prefix.start)
|
||||||
|
|
||||||
|
@ -200,16 +209,16 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
if path_tgt != path_tgt_new:
|
if path_tgt != path_tgt_new:
|
||||||
if main.cfg.armed:
|
if main.cfg.armed:
|
||||||
_print("moving §B%s§/ -> §B%s§/" %(path_tgt, path_tgt_new))
|
_print("moving §B%s§/ -> §B%s§/" %(path_tgt, path_tgt_new), prefix.start)
|
||||||
path_tgt.rename(path_tgt_new)
|
path_tgt.rename(path_tgt_new)
|
||||||
elif main.cfg.dump_commands:
|
elif main.cfg.dump_commands:
|
||||||
_print('will execute §Bmv "%s" "%s"§/' %(path_tgt, path_tgt_new), prefix.start)
|
_print('will execute §Bmv "%s" "%s"§/' %(path_tgt, path_tgt_new))
|
||||||
|
|
||||||
old_name = pathlib.Path(info.tmp_file)
|
old_name = pathlib.Path(info.tmp_file)
|
||||||
new_name = pathlib.Path(new_filename)
|
new_name = pathlib.Path(new_filename)
|
||||||
|
|
||||||
if main.cfg.armed:
|
if main.cfg.armed:
|
||||||
_print("moving §B%s§/ -> §B%s§/" %(old_name, new_name))
|
_print("moving §B%s§/ -> §B%s§/" %(old_name, new_name), prefix.start)
|
||||||
old_name.rename(new_name)
|
old_name.rename(new_name)
|
||||||
elif main.cfg.dump_commands:
|
elif main.cfg.dump_commands:
|
||||||
_print('will execute §Bmv "%s" "%s"§/' %(old_name, new_name), prefix.start)
|
_print('will execute §Bmv "%s" "%s"§/' %(old_name, new_name))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue