This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

tda4vm use gstreamer to split v4l2h264enc video

Other Parts Discussed in Thread: TDA4VM

I want to use gstreamer plugins (gst-plugins-good-1.22.7) to split video  in tda4vm  EVM as a node, call video_encode.but I find not cannot finish split video every 5 minutes.The problem is the split video is less 5 minutes,and the split video  has some duplicate frames and is random.

void construct_gst_strings(NMVideoEncodeConfig *config) {
  ENTRY_LOG
  int32_t i = 0;
  for (uint8_t ch = 0; ch < gst_wrapper_params.in_num_channels; ch++) {
    snprintf(gst_wrapper_params.m_AppSrcNameArr[ch], 32u, "myAppSrc%d", ch);
    i += snprintf(&gst_wrapper_params.m_cmdString[i], CODEC_MAX_LEN_CMD_STR - i,
                  "appsrc format=GST_FORMAT_TIME is-live=true "
                  "do-timestamp=true block=false name=%s ! queue \n",
                  gst_wrapper_params.m_AppSrcNameArr[ch]);
    i += snprintf(
        &gst_wrapper_params.m_cmdString[i], CODEC_MAX_LEN_CMD_STR - i,
        "! video/x-raw, width=(int)%d, height=(int)%d, "
        "framerate=(fraction)30/1, format=(string)%s, "
        "interlace-mode=(string)progressive, colorimetry=(string)bt601 \n",
        gst_wrapper_params.in_width, gst_wrapper_params.in_height,
        gst_wrapper_params.in_format);
    i += snprintf(&gst_wrapper_params.m_cmdString[i], CODEC_MAX_LEN_CMD_STR - i,
                  "! v4l2h264enc bitrate=%d \n", config->bitrate);
    i += snprintf(&gst_wrapper_params.m_cmdString[i], CODEC_MAX_LEN_CMD_STR - i,
                  "! h264parse \n");
    if (config->enable_split) {
      i += snprintf(&gst_wrapper_params.m_cmdString[i],
                    CODEC_MAX_LEN_CMD_STR - i,
                    "! splitmuxsink location=%s/output_video_%d_%%d.264 "
                    "max-size-time=300000000000\n",
                    config->storage_path, ch);
    } else {
      i += snprintf(&gst_wrapper_params.m_cmdString[i],
                    CODEC_MAX_LEN_CMD_STR - i,
                    "! filesink location=%s/output_video_%d.264 \n",
                    config->storage_path, ch);
    }
  }
  EXIT_LOG
}

  • Hello,

    Could you share more details about the video you are trying to split such as resolution, format and length? I would suggest running the gstreamer pipeline on target and sharing the output for debugging purposes.

    Thank you,

    Fabiana

  • we run the pipeline to record 1024x608 NV12 video for debugging purpose.  

    We conducted an experiment: use splitmuxsink to split video every 10 seconds (should be 300 frames with 30fps) to avoid generating large video files.

    but the outputvideo contains less than 300 frames.

    ffprobe shows output_video_0_0.mp4 has 180 frames, but if we use "ffmpeg -i output_video_0_0.mp4 %05d.jpg", the output is 266 images

  • my workmate supply some information about this ,you can see it,wish to get your help

  • Hello,

    Could you run the following pipeline after making changes that fit your use case?

    gst-launch-1.0 filesrc location=myfile.mp4 ! qtdemux ! splitmuxsink location=splitfile%02d.mkv max-size-time=20000000000 muxer=mp4mux name=mux

    Thank you,

    Fabiana