Transcoding GeniCam to HLS


Goal: GeniCam cameras output Bayer format raw video. We need HLS H.264.
Hardware setup at MaxxSports:
Camera connects to a low end Windows laptop by a 3 foot USB3 cable. Laptop is not capable to encode 1080p video, and it sends the raw video to a Linux server through optical fiber LAN.

The general flow:
In house Windows OpenCV application, mux.exe, reads and process the raw video from camera, and pipes it to ffmpeg.
ffmpeg sends raw video to ffserver through http.
ffserver encodes it into H.264, and expose a RTSP end point.
ffmpeg re-packages RTSP into HLS, and exposes it as a http URL.

Sample commands listed as following:
Raw video processing: mux.exe
Send raw video to ffserver:
mux.exe | ffmpeg.exe -re -f rawvideo -vcodec rawvideo -s 1920×1080 -r 30 -pix_fmt            bayer_rggb8 -i pipe:0 -g 1 http://awsq.MaxxSports.cc:555/feed.ffm
ffserver.conf parameters:
HttpPort 555
RtspPort 554
File /mnt/ebs/ffbuf/feed.ffm
<Stream bvsc.mp4>
Feed feed.ffm
Format rtp
VideoCodec libx264
Re-package from RTSP to HLS
ffmpeg -i http://awsq.MaxxSports.cc:554/bvsc.mp4 -f hls -hls_segment_filename /mnt/ebs/strm_%05d.ts -hls_time 6 -segment_list_flags +live -hls_list_size 12000 -hls_flags delete_segments -start_number 0 /mnt/ebs/strm.m3u8

Final HLS output URL:  http://awsq.MaxxSports.cc/strm.m3u8

Advertisements

Headless Ubuntu Server Installation with GeniCam cameras


To test GeniCam cameras, I installed headless Linux, Ubuntu Server 16.04.4 LTS, on a laptop, without graphics, to mimic our AWS servers, none of which have GUI. The whole process takes about one hour, excluding research time, of course. Some key notes are listed below.

  1. Download: https://www.ubuntu.com/download/server  over 800M, only half size of the Ubuntu desktop version.
  2. Bootable USB: created from the .iSO above, by rufus-2.18p.exe
  3. Boot from USB: Boot in UEFI mode. Booting from CD needs legacy mode.
  4. Boot manager: GRUB2 version 2.02
  5. Partitions: sda1: UEFI boot partition, sda5: Linux OS boot volume, I set it to 10G. The default AWS Root Device is only 8G
  6. Wireless: different from Desktop Network Manager. Some key commands are: (wlp6s0 is wireless interface name)
    1. sudo ifconfig wlp6s0 up
    2. sudo iwlist wlp6s0 scan
    3. sudo iwconfig wlp6s0 essid “RwAtt” key mypassword
    4. sudo dhclient -v wlp6s0
  7. GeniCam Camera driver installation(Smartek as example):
    1. install libnl-route-3-200
    2. build kernel module from source, which ends up as /lib/modules/4.4.0-116-generic/kernel/drivers/video/u3vdrv.ko
    3. add configuration to /etc/ld.so.conf.d
  8. Pitfalls: I always get boot failure with message “no bootable device found” whenever trying to if=/dev/sda5, or changing boot mode to Legacy then back to UEFI. I think it’s BIOS bug. Fix: tell BIOS the GRUB binary location by typing in \EFI\ubuntu\grubx64.efi in boot options in BIOS

What does GeniCam do for us?


To customize the content of billboard in sport games, e.g. for audience in different countries.

We change part of the video, namely the billboard content, while streaming the game. The end result is the billboard in streamed game video plays different content from the physical billboard on the game venue.

Our current cameras, all IP cameras, have two problems for this job:

  1. content needs to be decoded to process billboard, and then re-encoded, which is too much load on server
  2. hard to sync due to the delay introduced by codec and internet.

GeniCam cameras send raw video to our on site server through fiber network, with no decoding and ignorable delay. The cameras are connected to an IP strobe controller, as seen on picture.

Some components in addition to streaming are:

  1. Video process: OpenCV for object detection and Bayer pixel manipulation
  2. 3D billboard content generation: OpenGL
  3. Pull video from the cameras: GeniCam SDK

WordpressCam