如何解决jpegenc-使用VideoWriteOpenCV函数进行编码和存储
以下代码可以很好地捕获数据,解码和将解码后的数据存储在文件“ out.h364”中,而无需执行编码操作。
cv::VideoCapture cap("filesrc location=720p.mp4 ! qtdemux name=demux.video_0 ! h264parse ! video/x-h264,alignment=nal ! omxh264dec ! videoconvert ! appsink sync=false async=false",cv::CAP_GSTREAMER);
VideoWriter video("appsrc ! videoconvert ! filesink location=out.h264",cv::CAP_GSTREAMER,60,Size(1280,720),true);
cap >> frame;
video.write(frame);
现在,我想先执行编码操作,然后再将其存储到文件中。我尝试使用下面的代码对“ jpegenc” 编码器进行编码->将其存储在文件中。
VideoWriter video("appsrc ! videoconvert ! video/x-raw,width=1280,height=720,framerate=60/1,format=BGR ! jpegenc ! filesink location=out.mp4",true);
cap >> frame;
video.write(frame);
问题::它正在写入 out.mp4 文件,但无法播放。似乎无法正确存储数据。
有人可以指导我执行编码,然后将其存储到文件中吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。