This SDN SVC streaming framework is based on Dr. Chih-Heng Ke's myEvalSVC-Mininet. [1]
I modified the streamer and receiver to let SVC streaming send packets on 3 UDP ports (total 3 layers of SVC stream). By doing so, SDN controller can setup flow tables for each layer of SVC stream (based on different ports) and separate their routing path for better transmission quality.
The basic work flow of this SDN SVC streaming testing framework is to encoded the video into a 3-layer h264-svc video. Then, stream this SVC via 3 UDP ports to client in mininet environment. After the streaming finished, decode the h264-svc back to yuv and compare with source yuv video by PSNR value.
- JSVM installed. (Compiling may fail on new version of gcc, Ver4.1 works fine)
- SVEF [2] installed.
- Replace /src/streamer.c and /src/receiver.c of SVEF by the file of this Repo.
- Download myfixyuv.c for fixing the distorted video.
- Download the testing raw YUV video, i.e. foreman_cif.yuv [3].
- Mininet installed.
- Prepare the network topology with 1 host as a streamer and another host as the client, with mininet connect with both to simulate the network topology.
- Prepare the temporal encoding/decoding configuration file.
OutputFile temporal.264
FrameRate 30.0
FramesToBeEncoded 300
GOPSize 4
BaseLayerMode 2
IntraPeriod 4
SearchMode 4
SeachRange 32
NumLayers 1
LayerCfg temporal_layer0.cfg
InputFile foreman_cif.yuv
SourceWidth 352
SourceHeight 288
FrameRateIn 30
FrameRateOut 30
./H264AVCEncoderLibTestStatic -pf temporal_main.cfg > temporal_encoding.txt
4. Decode the temporal.264 record the decoding process into temporal_originaldecoderoutput.txt. We need some information from it.
./H264AVCDecoderLibTestStatic temporal.264 temporal.yuv > temporal_originaldecoderoutput.txt
5. Use the JSVM BitStreamExtractor to generate the original NALU trace file (temporal_originaltrace.txt)
./BitStreamExtractorStatic -pt temporal_originaltrace.txt temporal.264
6. Use f-nstamp to add the frame-number in temporal_originaltrace.txt. (It will generate temporal_originaltrace-frameno.txt)
mytools/svef-1.5/f-nstamp temporal_originaldecoderoutput.txt temporal_originaltrace.txt > temporal_originaltrace-frameno.txt
The topology may be vary to each one's experimental requirement. you have to create your own one.
sudo ./receiver 4455 myout.264 15000 > myreceivedtrace.txt
sudo ./streamer temporal_originaltrace-frameno.txt 30 10.0.0.2 4455 temporal.264 1 > mysent.txt
mytools/svef-1.5/nalufilter temporal_originaltrace-frameno.txt myreceivedtrace.txt 5000 30 > filteredtrace.txt
11. The current version of JSVM cannot decode video streams affected by out of order, corrupted, or missing NALUs. Therefore, SVEF uses filtered packet trace file to extract the corresponding packets in original h.264 video file by means of BitStreamExtractorStatic. (You can think that processed video file corresponds to the actually useful data received at the receiving side.)
./BitStreamExtractorStatic temporal.264 temporal-filtered.264 -et filteredtrace.txt
./H264AVCDecoderLibTestStatic temporal-filtered.264 temporal-filtered.yuv
13. We need the same number of video frames when we want to calculate the PSNR of original YUV and receiving YUV file. So we need to conceal the missing frames by copying the previous frame.
./myfixyuv filteredtrace.txt cif 300 temporal-filtered.yuv myfix.yuv
./PSNRStatic 352 288 foreman_cif.yuv myfix.yuv > result_psnr