You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am facing the problem in writing the file:
> I have check all things like checking the rect , frame
> nothing of them is empty or false
> I am getting the processed frame MAT
> What I am facing is that the file does not save and there is no error or anything... Please guide me about this...
> I have read your other Issues like #303 and #143 but I don't have much knowledge about FFmpeg write now. So please
make me clear according to my scenario...
> Here is some Code to make it more clear...
fourcc = cv2.VideoWriter_fourcc(*'MP4V')
cap = cv2.VideoCapture(filename)
flag = 1
if (cap.isOpened() == False):
print("Error opening video stream or file")
exit_key = ord('q')
while (cap.isOpened()):
ret, frame = cap.read()
if flag:
height, width, _ = frame.shape
out = cv2.VideoWriter(output+output_name, fourcc, 20.0, (2*width, height))
flag = 0
if ret:
print('Video is processing..', end='\r')
full_image = np.concatenate((frame, matte), axis=1)
full_image = np.uint8(cv2.resize(full_image, (2*width, height), cv2.INTER_AREA))
out.write(full_image)
> I am reading files and want to save files into the internal storage what I have done for that is:
--> This location is for the new processed file:
path = join(os.environ["HOME"], path) // path is suppose "output/"
os.makedirs(path, exist_ok=True)
if not path.endswith('/'):
path += '/'
return path
--> From Java Writing a file to Internal Storage:
Uri data = null;
if (result.getData() != null) {
data = result.getData().getData();
try {
b = new byte[getContentResolver().openInputStream(data).available()];
getContentResolver().openInputStream(data).read(b,0,b.length);
String myFilePath = getFilesDir() + "/" + "fahad.mp4";
File myFile = new File(myFilePath);
FileOutputStream fos = new FileOutputStream(myFile);
fos.write(b);
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
The text was updated successfully, but these errors were encountered:
As it says in #140, our builds of OpenCV don't support either reading or writing video files.
There's an example at #435 (comment) of using mobile-ffmpeg to convert the input video to PNG files, which you can then load and save individually in OpenCV. I'm not very familiar wth FFmpeg, but I guess there's probably a way of converting a sequence of PNG files back into a video, so that should solve your problem.
I am facing the problem in writing the file:
> I have check all things like checking the rect , frame
> nothing of them is empty or false
> I am getting the processed frame MAT
> What I am facing is that the file does not save and there is no error or anything... Please guide me about this...
> I have read your other Issues like #303 and #143 but I don't have much knowledge about FFmpeg write now. So please
make me clear according to my scenario...
> Here is some Code to make it more clear...
The text was updated successfully, but these errors were encountered: