Bypass Formant video encoder
How do I upload pre-encoded video?
- We're wondering how we can go about using the h264 bytes we've already encoded from our image streams instead of using Formant's encoding.
- We would like to remove any excess load on the device, so we'd like to try using the bytestream we already have.
Method 1: Agent SDK
To ingest video data without using the Formant encoder, you must send it using the post_image
method of the Formant Agent SDK as follows:
from formant.sdk.agent.v1 import Client
fclient = Client()
fclient.post_image(stream_name, frame, content_type="video/h264")
The byte-stream must be h264 encoded with a baseline
or constrained-baseline
profile.
For more information on the Agent SDK, including a definition of the post_image
method and its parameters, see the Agent SDK Reference.
For more information on adding a telemetry video stream, see Add a video stream.
For more information on adding a teleoperation video stream, see Add a teleoperation image stream.
Method 2: UDP stream
If you are generating video in a GStreamer application and you want to send that video to the Formant agent, you can do so via UDP.
Here is an example of a GStreamer launch string which uses a video test source, encodes it as H264 video, and sends it to the agent via a UDP sink:
gst-launch-1.0 videotestsrc \
! videoconvert \
! x264enc byte-stream=true tune=zerolatency bitrate=500 speed-preset=superfast key-int-max=15 \
! video/x-h264, profile=baseline, stream-format=byte-stream, alignment=au \
! h264parse disable-passthrough=true config-interval=-1 \
! rtph264pay pt=96 \
! udpsink host=<ip-of-agent-computer> port=<port>
On the agent side, follow the instructions for IP cameras in Add a video stream.
See also
If you notice an issue with this page or need help, please reach out to us! Use the 'Did this page help you?' buttons below, or get in contact with our Customer Success team via the Intercom messenger in the bottom-right corner of this page, or at [email protected].
Updated 8 days ago