Spaces:
Runtime error
Runtime error
changing codecs
Browse files
app.py
CHANGED
|
@@ -20,9 +20,16 @@ def create_video(image, audio):
|
|
| 20 |
# Create a composite video with the main image and the logo overlay
|
| 21 |
video_clip = CompositeVideoClip([image_clip, logo]).set_audio(audio_clip)
|
| 22 |
|
| 23 |
-
# Save the video to a temporary file
|
| 24 |
output_path = "/tmp/output_video_with_logo.mp4"
|
| 25 |
-
video_clip.write_videofile(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
return output_path
|
| 28 |
|
|
|
|
| 20 |
# Create a composite video with the main image and the logo overlay
|
| 21 |
video_clip = CompositeVideoClip([image_clip, logo]).set_audio(audio_clip)
|
| 22 |
|
| 23 |
+
# Save the video to a temporary file with Twitter-compatible settings
|
| 24 |
output_path = "/tmp/output_video_with_logo.mp4"
|
| 25 |
+
video_clip.write_videofile(
|
| 26 |
+
output_path,
|
| 27 |
+
fps=30,
|
| 28 |
+
codec="libx264",
|
| 29 |
+
audio_codec="aac",
|
| 30 |
+
preset="slow",
|
| 31 |
+
ffmpeg_params=["-b:v", "2000k"] # Adjust bitrate if needed
|
| 32 |
+
)
|
| 33 |
|
| 34 |
return output_path
|
| 35 |
|