Fix progress reporting and desktop responsiveness during encode
The progress bar barely moved and the window showed "not responding" during long encodes: ffmpeg's carriage-return stats line flushes rarely over a pipe, and the transcode saturated the CPU. - Drive progress from ffmpeg's structured `-progress pipe:1` output (`-stats_period 0.5 -nostats`) and parse out_time/progress in process_stdout, giving steady frequent updates (verified ~2/sec via the live executor pipe vs ~1 per whole encode before). - Run the encoder under `nice -n 10` so the compositor keeps a CPU slice (avconv gets the nice prefix too). Also round pad/crop targets to even dimensions and use positive crop offsets, fixing an odd-height (e.g. 1079) MPEG-2 error surfaced when burning in subtitles on a 1080p source. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
6cddd72792
commit
7f574897c7
2 changed files with 79 additions and 13 deletions
|
|
@ -148,6 +148,10 @@ class avconv(devedeng.avbase.avbase):
|
|||
else:
|
||||
self.final_length = video_length
|
||||
self.command_var = []
|
||||
# lower priority so the desktop stays responsive during the transcode
|
||||
self.command_var.append("nice")
|
||||
self.command_var.append("-n")
|
||||
self.command_var.append("10")
|
||||
self.command_var.append("avconv")
|
||||
if start_offset and start_offset > 0:
|
||||
self.command_var.append("-ss")
|
||||
|
|
@ -228,16 +232,19 @@ class avconv(devedeng.avbase.avbase):
|
|||
if (file_project.width_midle != file_project.original_width) or (file_project.height_midle != file_project.original_height):
|
||||
if (cmd_line != ""):
|
||||
cmd_line += ",fifo,"
|
||||
x = int((file_project.width_midle -
|
||||
file_project.original_width) / 2)
|
||||
y = int((file_project.height_midle -
|
||||
file_project.original_height) / 2)
|
||||
# MPEG-2 / yuv420p needs even dimensions; round to even so the
|
||||
# aspect math can't produce an odd pad/crop target (e.g. 1079).
|
||||
mid_w = file_project.width_midle - (file_project.width_midle % 2)
|
||||
mid_h = file_project.height_midle - (file_project.height_midle % 2)
|
||||
x = int((mid_w - file_project.original_width) / 2)
|
||||
y = int((mid_h - file_project.original_height) / 2)
|
||||
if (x > 0) or (y > 0):
|
||||
cmd_line += "pad=" + str(file_project.width_midle) + ":" + str(
|
||||
file_project.height_midle) + ":" + str(x) + ":" + str(y) + ":0x000000"
|
||||
cmd_line += "pad=" + str(mid_w) + ":" + str(
|
||||
mid_h) + ":" + str(x) + ":" + str(y) + ":0x000000"
|
||||
else:
|
||||
cmd_line += "crop=" + str(file_project.width_midle) + ":" + str(
|
||||
file_project.height_midle) + ":" + str(x) + ":" + str(y)
|
||||
# crop x/y are the (positive) top-left offset into the source
|
||||
cmd_line += "crop=" + str(mid_w) + ":" + str(
|
||||
mid_h) + ":" + str(abs(x)) + ":" + str(abs(y))
|
||||
|
||||
if (file_project.width_final != file_project.width_midle) or (file_project.height_final != file_project.height_midle):
|
||||
if (cmd_line != ""):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue