diff --git a/README.md b/README.md index ceddd76..b557bdb 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,9 @@ ## 应用开发 [LCD应用编程](./apps) + +[Gstreamer使用](./gst.md) + ## Uboot中驱动开发 [GPIO驱动](./uboot) diff --git a/debug/camera/README.md b/debug/camera/README.md index f2a75ba..14f561e 100644 --- a/debug/camera/README.md +++ b/debug/camera/README.md @@ -221,7 +221,7 @@ IQ文件会全部拷贝到etc/iqfiles目录下 /etc/init.d/S50set_pipeline start -### Test mipi camera on Buildroot +### Test mipi camera(on Buildroot system) Test mipi camera using gstreamer(camera_rkisp.sh) @@ -266,7 +266,7 @@ Dump picture to file(using 7yuv to view the file) --set-fmt-video=width=2112,height=1568,pixelformat=SBGGR10 \ --stream-mmap=3 --stream-to=/tmp/mp.raw.out --stream-count=1 --stream-poll -### USB摄像头使用(linux系统) +### USB摄像头使用(linux distro系统) [参考代码](./test_camera-uvc.sh) @@ -286,4 +286,4 @@ Dump picture to file(using 7yuv to view the file) 指定输出格式和大小 - su linaro -c 'gst-launch-1.0 v4l2src device=/dev/video8 ! "image/jpeg,width=640,height=480,framerate=30/1" ! mppvideodec ! rkximagesink sync=false' + su linaro -c 'gst-launch-1.0 v4l2src device=/dev/video0 ! "image/jpeg,width=640,height=480,framerate=30/1" ! mppvideodec ! rkximagesink sync=false' diff --git a/gst.md b/gst.md new file mode 100644 index 0000000..088fac2 --- /dev/null +++ b/gst.md @@ -0,0 +1,26 @@ +# Gstreamer使用 + +## 视频播放 + +使用gstreamer播放本地视频 + + export DISPLAY=:0.0 + gst-launch-1.0 uridecodebin uri=file:///usr/local/test.mp4 ! rkximagesink + +如果是root用户执行则要切换到普通用户 + + su linaro -c "gst-launch-1.0 uridecodebin uri=file:///usr/local/test.mp4 ! rkximagesink" + +## 编解码测试 + +编解码测试[参考代码](./test_enc.sh) + + export DISPLAY=:0.0 + su linaro -c "gst-launch-1.0 videotestsrc num-buffers=512 ! video/x-raw,format=NV12,width=1920,height= 1080,framerate=30/1 ! queue ! mpph264enc ! queue ! h264parse ! mpegtsmux ! filesink location=/home/linaro/2k.ts" + su linaro -c "gst-launch-1.0 uridecodebin uri=file:///home/linaro/2k.ts ! rkximagesink" + + +JPEG解码测试 + + export DISPLAY=:0.0 + su linaro -c 'gst-launch-1.0 -v videotestsrc ! "video/x-raw,width=1920,height=1080" ! queue ! jpegenc ! queue ! jpegparse ! queue ! mppvideodec ! rkximagesink' diff --git a/test_enc.sh b/test_enc.sh new file mode 100755 index 0000000..9ade1f3 --- /dev/null +++ b/test_enc.sh @@ -0,0 +1,13 @@ +#!/bin/sh +export DISPLAY=:0.0 +#export GST_DEBUG=*:5 +#export GST_DEBUG_FILE=/tmp/2.txt + +echo "message: output to /home/linaro/2k.ts!" + +su linaro -c "gst-launch-1.0 videotestsrc num-buffers=512 ! video/x-raw,format=NV12,width=1920,height= 1080,framerate=30/1 \ + ! queue ! mpph264enc ! queue ! h264parse ! mpegtsmux ! filesink location=/home/linaro/2k.ts" + +echo "message: playing encoded video!" + +su linaro -c "gst-launch-1.0 uridecodebin uri=file:///home/linaro/2k.ts ! rkximagesink"