Search code examples
cgstreamer

Is there command line command to test appsrc and appsink in a single line for gstreamer pipeline?


What I am trying to code

  1. Getting buffer from a h264 encoded mp4 file
  2. Passing the buffer to an appsink
  3. Then separately in another pipeline, the appsrc would read in the buffer
  4. The buffer would be h264parse and then send out through rtp using GstRTSPServer

Would want to simulate this for a CLI pipeline to make sure the video caps is working:

My attempts as follows: gst-launch-1.0 filesrc location=video.mp4 ! appsink name=mysink ! appsrc name=mysrc ! video/x-h264 width=720 height=480 framerate=30/1 ! h264parse config-interval=1 ! rtph264pay name=pay0 pt=96 ! udpsink host=192.168.x.x port=1234

But this doesnt really works and I not too sure this is how appsrc and appsink is used

Can some one enlighten me

EDIT: The file i am trying to play has the following property

General Complete name : video3.mp4 Format : AVC Format/Info : Advanced Video Codec File size : 45.4 MiB

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings, CABAC                   : No
Format settings, ReFrames                : 1 frame
Format settings, GOP                     : M=1, N=30
Width                                    : 720 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 3:2
Frame rate                               : 30.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive

Thanks


Solution

  • You won't be able to do this with appsink and appsrc, as these are explicitly meant to be used by an application to handle the input/output buffers.

    That being said, if what you really want is to test the caps on both sides, just connect them together. They both advertise "ANY" caps, which means they won't really influence the caps negotiation.

    gst-launch-1.0 filesrc location=video.mp4 ! \
        "video/x-h264, width=720, height=480, framerate=30/1" ! \
        h264parse config-interval=1 ! \
        rtph264pay name=pay0 pt=96 ! \
        udpsink host=192.168.x.x port=1234
    

    You'll get an error also, since MP4 is not the same as H264: the former is a container format, while the latter is a video codec. In your case, the MP4 file will probably contain an H.264 video: in that case, it should work by putting a qtdemux element after the filesrc.