|
本帖最后由 chuyee 于 2019-3-2 09:00 编辑
1. 通过dnf安装gstreamer-rockchip和mpp- $ sudo dnf install gstreamer-rockchip librockchip_rga librockchip_rtsp librockchip_vendor librockchip_isp librockchip_drm librockchip_mpp librockchip_rga-devel librockchip_rtsp-devel librockchip_vendor-devel librockchip_mpp-tests librockchip_drm-devel librockchip_mpp-devel
2. 验证gstreamer plugins
- $ gst-inspect-1.0 |grep rockchip
- rockchipmpp: mppjpegdec: Rockchip's MPP JPEG image decoder
- rockchipmpp: mppjpegenc: Rockchip Mpp JPEG Encoder
- rockchipmpp: mpph264enc: Rockchip Mpp H264 Encoder
- rockchipmpp: mppvideodec: Rockchip's MPP video decoder
3. 使用opencv C++ API打开并保存视频文件VideoCapture cap("/home/toybrick/Downloads/input.mp4");
printf("frame count: %d\n", cap.get(CV_CAP_PROP_FRAME_COUNT));
VideoWriter video("output.avi", CV_FOURCC('X', '2', '6', '4'), 30, Size(640, 480));
while (cap.isOpened()) {
cap >> frame;
video.write(frame);
}
4. 运行以上程序得到的console信息
- Failed to query video capabilities: Inappropriate ioctl for device
- libv4l2: error getting capabilities: Inappropriate ioctl for device
- VIDEOIO ERROR: V4L: device /home/toybrick/input.mp4: Unable to query number of channels
- mpi: mpp version: Without VCS info
- mpp_rt: NOT found ion allocator
- mpp_rt: found drm allocator
- mpp: deprecated block control, use timeout control instead
- warning: GStreamer: unable to query duration of stream (/builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp:904)
- warning: Cannot query video position: status=1 value=0 duration=-1
- (/builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp:952)
- frame count: -1
- mpi: mpp version: Without VCS info
- h264e_api: h264e_config MPP_ENC_SET_RC_CFG bps 1555200 [1458000 : 1652400]
- **
- ERROR:gstmppvideoenc.c:115:gst_mpp_video_enc_stop: assertion failed: (g_atomic_int_get (&self->active) == FALSE)
- Aborted (core dumped)
这里面有两个问题,都应该很容易复现:
1. mpph264enc plugin assert. 这个会导致视频最后几帧无法写入。
2. CV_CAP_PROP_FRAME_COUNT读出来的frame count = -1。这会导致程序无法确定输入视频的长度(duration)。
|
|