unify formating, better debug message
This commit is contained in:
parent
9aee69db0d
commit
cc7fe5fad3
@ -21,16 +21,15 @@ def output():
|
||||
ff_pre_settings = [
|
||||
'-pix_fmt', 'yuv420p', '-r', str(_pre.fps),
|
||||
'-c:v', 'mpeg2video', '-intra',
|
||||
'-b:v', '{}k'.format(_pre.v_bitrate),
|
||||
'-minrate', '{}k'.format(_pre.v_bitrate),
|
||||
'-maxrate', '{}k'.format(_pre.v_bitrate),
|
||||
'-bufsize', '{}k'.format(_pre.v_bufsize)
|
||||
'-b:v', f'{_pre.v_bitrate}k',
|
||||
'-minrate', f'{_pre.v_bitrate}k',
|
||||
'-maxrate', f'{_pre.v_bitrate}k',
|
||||
'-bufsize', f'{_pre.v_bufsize}k'
|
||||
] + pre_audio_codec() + ['-f', 'mpegts', '-']
|
||||
|
||||
if _text.add_text and not _text.over_pre:
|
||||
messenger.info('Using drawtext node, listening on address: {}'.format(
|
||||
_text.address
|
||||
))
|
||||
messenger.info(
|
||||
f'Using drawtext node, listening on address: {_text.address}')
|
||||
overlay = [
|
||||
'-vf',
|
||||
"null,zmq=b=tcp\\\\://'{}',drawtext=text='':fontfile='{}'".format(
|
||||
@ -38,9 +37,13 @@ def output():
|
||||
]
|
||||
|
||||
try:
|
||||
_ff.encoder = Popen([
|
||||
enc_cmd = [
|
||||
'ffplay', '-hide_banner', '-nostats', '-i', 'pipe:0'
|
||||
] + overlay, stderr=PIPE, stdin=PIPE, stdout=None)
|
||||
] + overlay
|
||||
|
||||
messenger.debug(f'Encoder CMD: "{" ".join(enc_cmd)}"')
|
||||
|
||||
_ff.encoder = Popen(enc_cmd, stderr=PIPE, stdin=PIPE, stdout=None)
|
||||
|
||||
enc_err_thread = Thread(target=ffmpeg_stderr_reader,
|
||||
args=(_ff.encoder.stderr, False))
|
||||
@ -58,20 +61,21 @@ def output():
|
||||
|
||||
try:
|
||||
for src_cmd in get_source.next():
|
||||
messenger.debug('src_cmd: "{}"'.format(src_cmd))
|
||||
if src_cmd[0] == '-i':
|
||||
current_file = src_cmd[1]
|
||||
else:
|
||||
current_file = src_cmd[3]
|
||||
|
||||
_current.clip = current_file
|
||||
messenger.info('Play: "{}"'.format(current_file))
|
||||
messenger.info(f'Play: {current_file}')
|
||||
|
||||
with Popen([
|
||||
'ffmpeg', '-v', _log.ff_level.lower(), '-hide_banner',
|
||||
'-nostats'] + src_cmd + ff_pre_settings,
|
||||
stdout=PIPE, stderr=PIPE) as _ff.decoder:
|
||||
dec_cmd = ['ffmpeg', '-v', _log.ff_level.lower(),
|
||||
'-hide_banner', '-nostats'
|
||||
] + src_cmd + ff_pre_settings
|
||||
|
||||
messenger.debug(f'Decoder CMD: "{" ".join(dec_cmd)}"')
|
||||
|
||||
with Popen(dec_cmd, stdout=PIPE, stderr=PIPE) as _ff.decoder:
|
||||
dec_err_thread = Thread(target=ffmpeg_stderr_reader,
|
||||
args=(_ff.decoder.stderr, True))
|
||||
dec_err_thread.daemon = True
|
||||
|
@ -23,16 +23,15 @@ def output():
|
||||
ff_pre_settings = [
|
||||
'-pix_fmt', 'yuv420p', '-r', str(_pre.fps),
|
||||
'-c:v', 'mpeg2video', '-intra',
|
||||
'-b:v', '{}k'.format(_pre.v_bitrate),
|
||||
'-minrate', '{}k'.format(_pre.v_bitrate),
|
||||
'-maxrate', '{}k'.format(_pre.v_bitrate),
|
||||
'-bufsize', '{}k'.format(_pre.v_bufsize)
|
||||
'-b:v', f'{_pre.v_bitrate}k',
|
||||
'-minrate', f'{_pre.v_bitrate}k',
|
||||
'-maxrate', f'{_pre.v_bitrate}k',
|
||||
'-bufsize', f'{_pre.v_bufsize}k'
|
||||
] + pre_audio_codec() + ['-f', 'mpegts', '-']
|
||||
|
||||
if _text.add_text and not _text.over_pre:
|
||||
messenger.info('Using drawtext node, listening on address: {}'.format(
|
||||
_text.address
|
||||
))
|
||||
messenger.info(
|
||||
f'Using drawtext node, listening on address: {_text.address}')
|
||||
overlay = [
|
||||
'-vf',
|
||||
"null,zmq=b=tcp\\\\://'{}',drawtext=text='':fontfile='{}'".format(
|
||||
@ -40,15 +39,18 @@ def output():
|
||||
]
|
||||
|
||||
try:
|
||||
_ff.encoder = Popen([
|
||||
enc_cmd = [
|
||||
'ffmpeg', '-v', _log.ff_level.lower(), '-hide_banner',
|
||||
'-nostats', '-re', '-thread_queue_size', '256', '-i', 'pipe:0'
|
||||
] + overlay + [
|
||||
'-metadata', 'service_name=' + _playout.name,
|
||||
'-metadata', 'service_provider=' + _playout.provider,
|
||||
'-metadata', 'year={}'.format(year)
|
||||
] + _playout.ffmpeg_param + _playout.stream_output,
|
||||
stdin=PIPE, stderr=PIPE)
|
||||
'-metadata', f'year={year}'
|
||||
] + _playout.ffmpeg_param + _playout.stream_output
|
||||
|
||||
messenger.debug(f'Encoder CMD: "{" ".join(enc_cmd)}"')
|
||||
|
||||
_ff.encoder = Popen(enc_cmd, stdin=PIPE, stderr=PIPE)
|
||||
|
||||
enc_err_thread = Thread(target=ffmpeg_stderr_reader,
|
||||
args=(_ff.encoder.stderr, False))
|
||||
@ -66,20 +68,21 @@ def output():
|
||||
|
||||
try:
|
||||
for src_cmd in get_source.next():
|
||||
messenger.debug('src_cmd: "{}"'.format(src_cmd))
|
||||
if src_cmd[0] == '-i':
|
||||
current_file = src_cmd[1]
|
||||
else:
|
||||
current_file = src_cmd[3]
|
||||
|
||||
_current.clip = current_file
|
||||
messenger.info('Play: "{}"'.format(current_file))
|
||||
messenger.info(f'Play: {current_file}')
|
||||
|
||||
with Popen([
|
||||
'ffmpeg', '-v', _log.ff_level.lower(), '-hide_banner',
|
||||
'-nostats'] + src_cmd + ff_pre_settings,
|
||||
stdout=PIPE, stderr=PIPE) as _ff.decoder:
|
||||
dec_cmd = ['ffmpeg', '-v', _log.ff_level.lower(),
|
||||
'-hide_banner', '-nostats'
|
||||
] + src_cmd + ff_pre_settings
|
||||
|
||||
messenger.debug(f'Decoder CMD: "{" ".join(dec_cmd)}"')
|
||||
|
||||
with Popen(dec_cmd, stdout=PIPE, stderr=PIPE) as _ff.decoder:
|
||||
dec_err_thread = Thread(target=ffmpeg_stderr_reader,
|
||||
args=(_ff.decoder.stderr, True))
|
||||
dec_err_thread.daemon = True
|
||||
|
Loading…
Reference in New Issue
Block a user