omxh264enc cannot stream to HLS: black screen in Safari and iOS
Submitted by min..@..arp.fm
Video encoded with the omxh264enc codec results in a black screen on Safari and iOS. No warnings or errors appear.
The video plays on VLC, but seems to "freeze" periodically. Again, no warnings or errors appear.
Other bugs suggest that omxh264enc should be capable of producing streaming video, but I cannot find a combination of gstreamer versions that work at all.
The Apple mediastreamvalidator tool passes the stream as "OK" with no warnings or errors. A separate bug has been raised with Apple to fix mediastreamvalidator and stop it passing broken streams.
The Adobe HLS validator claims SPS/PPS headers are missing and this is why the stream won't play.
Getting the omxh264enc encoder up and running on the debugger shows that OMX_IndexParamBrcmVideoAVCInlineHeaderEnable and OMX_IndexConfigVideoAVCIntraPeriod are being set, but neither of these options are documented nor do they have any measurable effect.
The RPi has the required mpeg2 license.
The command line used is this:
gst-launch-1.0 -v udpsrc port=5004 multicast-group=18.104.22.168 caps="application/x-rtp,media=(string)video,clock-rate=(int)90000" ! rtpbin ! rtpmp2tdepay ! tsdemux name=demux ! mpegvideoparse ! omxmpeg2videodec ! queue ! videoconvert ! deinterlace ! videoscale ! video/x-raw,width=960,height=540 ! omxh264enc target-bitrate=5000000 control-rate=variable inline-header=true periodicty-idr=1 interval-intraframes=1 ! queue ! mpegtsmux name=mux ! hlssink location=/var/www/stream/segment2%05d.ts playlist-location=/var/www/stream/output2.m3u8 playlist-root=http://192.168.225.3/stream/ target-duration=2