How to Write the Video from the numpy array as well as adding the Audio to that Video File. #21
Replies: 3 comments 10 replies
-
|
@SohamTilekar - A timely question as I just worked on the exact same case! Based on your code snippet, using the video stream writer works the best for your case. Try this: with tempfile.NamedTemporaryFile(
suffix=".wav", prefix=audio_name + "_temp_audio_"
) as temp_audio_file:
if self.audio and audio:
self.audio.write_audio_file(temp_audio_file)
audio_file_name = temp_audio_file.name
ffmpeg_options.update(
{"extra_inputs": [temp_audio_file], "acodec": "copy", "map": ["0:v", "1:a"]}
)
with ffmpegio.open(
filename,
"wv",
fps,
**ffmpeg_options,
overwrite=over_write_output,
show_log=True,
) as f:
for I in self.iterate_frames_array_t(fps):
f.write(I)The As for the stream writer, it works like the batch writer, but you define the mode If you cannot get it to work, post the ffmpeg log along with your code. |
Beta Was this translation helpful? Give feedback.
-
|
I Modified the code Little bit Then I Get the BrokenPipe Error. Modified Code: - Error: -
|
Beta Was this translation helpful? Give feedback.
-
|
If You Want to see whole Code The Repo Link: - vidiopy. How to use: - |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I Have a Video clip as Numpy array in memory and An Audio Saved on the Disk. I Want to Write the Video Using the Numpy array With the Audio which is saved on the Disk.
Below is My Current Code: -
Beta Was this translation helpful? Give feedback.
All reactions