我有个django。我使用cv2.VideoWriter创建了一个带有图像列表的视频。 在本地使用此代码:
video_name = os.path.join(tmpdir, 'video_test_stream.mp4')
video = cv2.VideoWriter(video_name, -1, 1, (640, 480))
视频文件已创建,一切正常。
但是当我在ubuntu服务器上推送时,未创建视频文件,并且我的应用程序崩溃了。 我想我在服务器上没有很好的权限,但是我不知道如何添加授权以及为哪个用户
答案 0 :(得分:0)
您已经提到您的代码可以在本地计算机上编写视频,
我们假定已经安装了使用opencv编写mp4视频的所有先决条件
(即使用H.264编译的ffmpeg软件包)
很少有建议确保服务器中所有必备组件都可用
1. ffmpeg package compiled with H.264 is already installed in the server machine.
2. Installation of open-cv in anaconda will reduce the stress to install ffmpeg package compiled with H.264
3. Make sure that the user created in the server machine has got enough privilege to read and write in specific application related directories
a. Check the read and write permission using the command below
ls -ld <folder-path>
or
namei -mo <folder-path>
b. Alter the access writes based on the user privilege required (sudo access needed else we need to engage admin to alter the permission)
eg : sudo chmod -R 740 <folder-path>** [ Recursive rwx for user ,r for group ]