Hi,
I am trying to start the StreamingMediaEncoder with format=hls and also give the following muxer options- “hls_playlist_type” and “hls_time” (ffmpeg reference).
But it seems that there is no argument for muxer options (documentation link). I tried setting the options under the encoder_option argument of the add_video_stream method, but this does not work and results in “RuntimeError: Unexpected options: hls_playlist_type, hls_time”.
Is there any way to do this with torio?
import torch
from torio.io import StreamingMediaEncoder
writer = StreamingMediaEncoder(
hls_output_path,
format="hls",
# No options
# options={"hls_time": "2", "hls_playlist_type": "event"},
)
width = 640 # Frame width
height = 360 # Frame height
writer.add_video_stream(
frame_rate=25,
encoder="libx264",
encoder_option={
"g": "10",
},
width=width,
height=height,
)
with writer.open():
for i in range(100):
print("Generating random frames")
frame = torch.randint(0, 256, (10, 3, height, width), dtype=torch.uint8)
print("Writing frame to stream...")
writer.write_video_chunk(0, frame)