Wenden Sie mehrere Textfilter gleichzeitig an und verbrennen Sie in ein Video zum Bildunterschriften ohne Neukodierung uPython

Python-Programme
Anonymous
 Wenden Sie mehrere Textfilter gleichzeitig an und verbrennen Sie in ein Video zum Bildunterschriften ohne Neukodierung u

Post by Anonymous »

Gibt es eine Möglichkeit, Text in ein Video zu verbrennen, ohne neu zu kennern? Ich frage dies, weil der Neukodierprozess beim Schreiben in WebM rund 0,1x Geschwindigkeit auf meinem Gerät verläuft. Alternativ, wenn es eine schnellere Möglichkeit gibt, qualitativ hochwertige Videos schnell zu machen und gleichzeitig neu zu kodieren, wäre dies großartig. Ich erinnere mich vage an jemanden, der in eine temporäre Datei geschrieben hat, um dieses Problem zu lösen.

Code: Select all

def processVideo(self):
print("creating video")

# File location management
font_path = self.input_path / "CalSans-Regular.ttf"
background_path = self.input_path / "new_video_background.webm"
audio_path = self.sound_output_path
video_ouput_path = self.parent_path / "new_result.webm"
sound_input = ffmpeg.input(str(audio_path))
video_input = ffmpeg.input(str(background_path))

# Adding captions
print(self.text_caption)
previous_timepoint = 0
for caption, timepoint in zip(self.text_caption, self.timepoints, strict=False):
# Text caption and timepooints are lists where the end of the words in text_caption correspond
# to the timepoint with the same index in timepoint
video_input = video_input.drawtext(
text=caption,
fontfile = font_path,
x='w-text_w/2',
y='h-text_h/2',
escape_text=True,
fontsize= 32,
bordercolor = "black",
borderw = 4,
enable=f'between(t,{previous_timepoint},{timepoint["timeSeconds"]})'
)
previous_timepoint = timepoint["timeSeconds"]

# Combining sound and video and writing output
command = ffmpeg.output(sound_input, video_input, str(video_ouput_path), codec='copy').overwrite_output().global_args('-shortest')
print("args =", command)
print(command.get_args())
command.run()
print("done!")
< /code>
  File "c:\Desktop\Projects\video_project\main.py", line 239, in 
post_list[0].processVideo()
~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "c:\Desktop\Projects\video_project\main.py", line 223, in processVideo
command.run()
~~~~~~~~~~~^^
File "C:\Desktop\Projects\video_project\.venv\Lib\site-packages\ffmpeg\_run.py", line 313, in run
process = run_async(
stream_spec,
......
overwrite_output=overwrite_output,
)
File "C:\Desktop\Projects\video_project\.venv\Lib\site-packages\ffmpeg\_run.py", line 284, in run_async
return subprocess.Popen(
~~~~~~~~~~~~~~~~^
args, stdin=stdin_stream, stdout=stdout_stream, stderr=stderr_stream
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\AppData\Local\Programs\Python\Python313\Lib\subprocess.py", line 1038, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pass_fds, cwd, env,
^^^^^^^^^^^^^^^^^^^
......
gid, gids, uid, umask,
^^^^^^^^^^^^^^^^^^^^^^
start_new_session, process_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\AppData\Local\Programs\Python\Python313\Lib\subprocess.py", line 1550, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
# no special security
^^^^^^^^^^^^^^^^^^^^^
......
cwd,
^^^^
startupinfo)
^^^^^^^^^^^^
FileNotFoundError: [WinError 206] The filename or extension is too long

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post