简体   繁体   中英

how to deal with live raw h264 stream to send over network

what I want to do is that send live camera stream which is encoded by h264 to gstreamer. I already have seen many example which send over network by using rtp and mpeg-ts. But problem is that all those examples assume that the input will be served by fixed file or live stream which is already transcoded in transport portocol like below.

client : gst-launch-1.0 videotestsrc horizontal-speed=5 ! x264enc tune="zerolatency" threads=1 ! mpegtsmux ! tcpserversink host=192.168.0.211 port=8554

server : gst-launch-1.0 tcpclientsrc port=8554 host=192.168.0.211 ! tsdemux ! h264parse ! avdec_h264 ! xvimagesink

But, My camera offer the below interface (written in java, actually work on adnroid). The interface offer just live raw h264 blocks.

mReceivedVideoDataCallBack=newDJIReceivedVideoDataCallBack(){
    @Override
    public void onResult(byte[] videoBuffer, int size)
    {
}

I can create tcp session to send those data block. But, how can i make those data which is not packed in transport protocol into format which is understable by gstreamer tcpclient? Transcode the original stream in ts format in the camera side can be a solution. But i have no clue to do transcode from non-file and non-transport-format data. I have searched gstreamer and ffmpeg, But I could not derive a way to deal h264 block stream using the supported interface, unitl now. Or, Are there any way to make gstreamer to directly accept those simple raw h264 block?

I think the best solution is to create your own element for your video source and then construct a pipeline using your element and mpegtsmux .

However, you can use appsrc + mpegtsmux and feed your appsrc through JNI with buffers you have from callback.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM