Before running the following codes, please make sure that you have correctly installed GNURadio and ffmpeg in your linux OS. You should also install Python in your linux since we need it to convert C++ APIs into Python APIs for GNURadio. How to install GNURadio, please refer to: http://gnuradio.org/redmine/projects/gnuradio/wiki/InstallingGR How to install ffmpeg and x264 under Ubuntu, please refer to: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu Note: Please run the commands at the receiving side first, then start to run the commands at the sending side. Sender Side: 1. Compile the C++ codes of Raptor codes in https://github.com/ywu40/RaptorCodes_Cplusplus_Python sudo swig -c++ -python raptor_decoder.i sudo python setup_decoder.py build_ext --inplace 2. After compiling, two files are generated: _raptor_decoder.so raptor_decoder.py 3.Copy the following files to GNURadio installing directory gnuradio/gr-digital/examples/narrowband _raptor_decoder.so raptor_decoder.py test_raptor_video_tx.py test_raw_video_tx.py foreman_cif.264 1)test_raptor_video_tx.py is use to test the performance of sending the video data with Raptor codes protection 2)test_raw_video_tx.py is to send the video data without any FEC protection 3)foreman_cif.264 is the testing stream 4. Send the video data over usrp with Raptor codes python test_raptor_video_tx.py --tx-freq=908M --rx-freq=921975000 --rx-gain=30 --tx-gain=30 --tx-amplitude=1 -p 1 -T 200 1)p: packet loss rate (%) 2)T: source symbols size 5. Send the video data over usrp without Raptor codes python test_raw_video_tx.py --tx-freq=908M --rx-freq=921975000 --rx-gain=30 --tx-gain=30 --tx-amplitude=1 -k 200 1)p: packet loss rate (%) 2)T: source symbols size Receiver Side: 1. Compile the C++ codes of Raptor codes in https://github.com/ywu40/RaptorCodes_Cplusplus_Python sudo swig -c++ -python raptor_decoder.i sudo python setup_decoder.py build_ext --inplace 2. After step 1, copy the following files to the directory gnuradio/gr-digital/examples/narrowband _raptor_decoder.so raptor_decoder.py test_raptor_video_rx.py test_raw_video_rx.py 1)test_raptor_video_rx.py is use to receive the video data with Raptor codes protection 2)test_raw_video_rx.py is to receive the video data without any FEC protection 3. Receive the video data over usrp with Raptor codes python test_raptor_video_rx.py --rx-freq=908M --tx-freq=921975000 --rx-gain=30 --tx-gain=30 --tx-amplitude=1 -p 1 1)p: packet loss rate (%) 2)T: source symbols size 4. Receive the video data over usrp without Raptor codes python test_raw_video_rx.py --rx-freq=908M --tx-freq=921975000 --rx-gain=30 --tx-gain=30 --tx-amplitude=1 -p 1 1)p: packet loss rate (%) 2)T: source symbols size 5. ffplay 1) Play the video stream with Raptor codes protection ffplay -f h264 output_raptor.264 2) Play the video stream without Raptor codes protection ffplay -f h264 output_no_raptor.264 6. h.264 streams are converted to yuv avconv -i output_raptor.264 -s 352x288 out_raptor.yuv Note: a)avconv is a tool of ffmpeg b)out_raptor.yuv is the yuv (raw video) format c)-i: input file d)-s: the video resolution (or size), in this experiment is CIF (352*288) 7. use mplayer to play the yuv file You can use mplayer as a YUV player with the example command below. mplayer foreman.qcif -demuxer rawvideo -rawvideo qcif command format: mplayer “yuv filename” -demuxer rawvideo -rawvideo “qcif,cif”
ywu40/GNURadio_RaptorCodes_Video
This project shows how to use Raptor codes to provide FEC protection for H.264 video data in GNURadio and USRP board.
Python