g-unit-2
(g-unit-2)
April 15, 2024, 12:47am
1
Given a simple web server @ local
streaming h.264 video using picamera2
streams to localhost:port in browser
As a developer creating a stream media source asset and providing the the correct host and port
the below error is received upon trying to open the media source.
ERROR
LogAvfMedia:
Warning: Failed to load video tracks.
The operation couldn’t be completed.
CoreMediaErrorDomain error -12939
byte range length mismatch - should be length 2 is length 182)
see below for example web server implementation.
#!/usr/bin/python3
# Mostly copied from https://picamera.readthedocs.io/en/release-1.13/recipes2.html
# Run this script, then point a web browser at http:<this-ip-address>:8000
# Note: needs simplejpeg to be installed (pip3 install simplejpeg).
import io
import logging
import socketserver
from http import server
from threading import Condition
from picamera2 import Picamera2
from picamera2.encoders import JpegEncoder
from picamera2.outputs import FileOutput
PAGE = """\
<html>
<head>
<title>picamera2 MJPEG streaming demo</title>
This file has been truncated. show original
Notes.
Possible header length is incorrect.
content = PAGE.encode(‘utf-8’)
self.send_header(‘Content-Length’, len(content))
???
nande
(nande)
April 15, 2024, 12:55am
2
python code looks ok to me.
have you tried this on the web?
quite possibly though ue is trying to use a technique that queries the file before actually loading.
requesting only 2 bytes and you send the whole frame. this is very common but your code is a more simple implementation.
or maybe you’re only sending 2 bytes.
check this
might be good to ensure this is not a CORS issue.