RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
237 stars 29 forks source link

UDP h264 video stream #2056

Closed edevdoge closed 2 weeks ago

edevdoge commented 3 weeks ago

Hi! Is it possible to receive a UDP h264 video stream on the Android platform (Oculus Quest 3) using AVProVideo? Stream is sent to specified IP and port in local network. I've tried to receive it using absolute path udp://@:5000 but nothing works. I just get "File not found, codec not supported, video resolution too high or insufficient system resources". Thanks!

Ste-RH commented 3 weeks ago

I think it might be possible to playback over UDP, but it depends on what's underneath.

See here and here.

edevdoge commented 3 weeks ago

So, I've tried sending stream with ffmpeg and gstreamer commands:

  1. ffmpeg -re -i D:/test.mp4 -c:v libx264 -preset ultrafast -tune zerolatency -f mpegts -omit_video_pes_length 1 udp://:
  2. ffmpeg -re -i D:/test.mp4 -c:v libx264 -preset ultrafast -tune zerolatency -f h264 omit_video_pes_length 1 udp://:
  3. gst-launch-1.0 filesrc location=D:/test.mp4 ! decodebin ! x264enc tune=zerolatency ! mpegtsmux ! udpsink host= port=
    With the first stream-send command it could be received in android build. The second and the third commands were unsuccessful. But the first command uses MPEG-TS for output and I need rtp. And I wonder why receiving a stream from gstreamer does not work
Ste-RH commented 3 weeks ago

All the examples of serving over upd via ffmpeg all use mpegts but that is the just the container format. Your frames are still going to be h264 as you are forcing that with -c:v. -f h264 is invalid as it is not a container format. -f mp4 would be valid, but I suspect you would need a fragmented mp4 format as opposed to just mp4...and I cannot find reference to ffmpeg supporting that.

Conclusion, your first command will be serving up h264 video frames, just via the container format of mpegts...which is fine, no?