Now I have a Gstreamer script which has
- Get a camera by using nvarguscamerasrc
- Display picture frame
- Encode video by H.264(nvv4l2h264enc) and save as a mp4 file.
#/bin/bash
SENSOR_ID=${1:-"0"}
echo "SENSOR_ID: $SENSOR_ID"
gst-launch-1.0 -e -v nvarguscamerasrc sensor-id="$SENSOR_ID" sensor_mode=0 exposuretimerange='11000000 11000000' ee-mode='0' ispdigitalgainrange='1 8' ! 'video/x-raw(memory:NVMM), width=1936, height=1220, framerate=(fraction)30/1, format=NV12' ! tee name=t \
t. ! queue ! nvvidconv flip-method=0 ! fpsdisplaysink video-sink=xvimagesink text-overlay=false sync=false \
t. ! queue ! nvv4l2h264enc ! h264parse ! qtmux ! filesink location=/media/test/output_"$SENSOR_ID".mp4
For analysing mp4 file, I want to put a timestamp into SEI at the beginning of each mdat atom like;
01 3f 94 83 6d 64 61 74 00 00 00 02 09 50 00 00 00 16 06 05 12 30 20 31 37 31 39 33 38 31 34 34 .?��mdat.....P.......0 171938144
33 37 37 33 31 30 38 80 00 00 38 d0 65 b8 04 00 5f fe b5 df 32 c5 88 12 83 05 58 85 4e 51 50 ba 3773108�..8�e�.._���2ň.�.X�NQP�
e9 dc 75 45 f7 f4 4a 97 82 8b 43 54 c9 3d 8a 07 b2 6a 5d d2 3a af d8 99 ba 41 a3 22 9e f6 8a da ��uE��J���CT�=�.�j]�:�ؙ�A�"����
Where;
01 3f 94 83 : size of this mdat
6d 64 61 74 : "mdat"
00 00 00 02 : NAL #1
09 50 : AU delimiter
00 00 00 16 : NAL #2
06 05 12 30 20 31 37 31 39 33 38 31 34 34 33 37 37 33 31 30 38 80 : NAL UNIT header(06), SEI message type (user data unregistered)(05), SEI message size(12), '0', ' ', timestamp in nano secs. ("1719381443773108"), SEI End (80)
How can I put these messages in SEI?