embedding video is HTML report #10697
Replies: 3 comments 5 replies
-
Could you properly format your post using code blocks for code and terminal outputs? Thanks. Additionally, your code is not reproducible. This being said, you could try adding project:
resources:
- "path/to/videos/*.mp4" |
Beta Was this translation helpful? Give feedback.
-
test_video.mp4Here is example using provided test video (required to change ---
title: "Speed Missmatch"
format:
html:
page-layout: full
code-fold: true
jupyter: python3
---
```{python}
#| echo: false
from moviepy.video.io.VideoFileClip import VideoFileClip
import tempfile
#path to the provided video
VIDEO_PATH = ".../test_video.mp4"
# this is calculated from data (its not deterministic)
# thus videos clips are not available for adding to yaml
TIME_SEGMENTS = [(1.0, 3.0), (5.0, 7.0)]
```
```{python}
#| output: asis
#| echo: false
video = VideoFileClip(VIDEO_PATH).without_audio()
print("\n\n::: {.panel-tabset .nav-pills}\n\n")
for i, (t_start, t_end) in enumerate(TIME_SEGMENTS, start = 1):
video_subclip = video.subclip(
t_start = max(0, t_start),
t_end = min(t_end, video.duration)
)
with tempfile.NamedTemporaryFile(suffix = ".mp4", delete = False) as temp_file:
video_subclip.write_videofile(
filename = temp_file.name,
codec = "libx264",
logger = None
)
print(f"\n\n## Video: {i}\n\n")
print(f"\n\n{{{{< video {temp_file.name} >}}}}\n\n")
video_subclip.reader.close()
if video_subclip.audio:
video_subclip.audio.reader.close_proc()
print(":::")
video.reader.close()
if video.audio:
video.audio.reader.close_proc()
``` |
Beta Was this translation helpful? Give feedback.
-
@mcanouil thank you for your guidance and patience. I've created repo: https://github.com/RegularnaMatrica/quarto_video_test.git Problem: locally everything works fine. When I send html alongside quarto created files folder to the colleague he can't run videos. Is it possible to somehow automatically export these videos so that they render on other machine. |
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.
-
Description
I'm dynamically adding videos (subclips) to HTML report:
When I open html it displays videos nicely, but once I send it to colleague (html alongside created files folder) he can't see/play videos. This makes sense because videos are saved locally on my PC, but why aren't they exported in files folder? Is it possible to somehow export them automatically to file folder created by quarto?
P.S. In case of 'many' videoclips I would like to have dropdown menu. I searched for this option, but I found that this is no yet possible with quarto. Is this still right?
Beta Was this translation helpful? Give feedback.
All reactions