can not open the recorded video file in recordingComplete function
Opened this issue · 6 comments
void ofApp::recordingComplete(ofxVideoRecorderOutputFileCompleteEventArgs& args){
cout << "The recoded video file is now complete." << endl;
shared_ptr<ofVideoPlayer> player = std::make_shared<ofVideoPlayer>();
player->load(args.fileName); // error
players.push_back(player);
}
console says
error loading asset tracks: Cannot Open
Do you know why I can't load the file there?
Have you verified that the file exists and is playable? I'm sorry there is not much information for me to go on.
Yes, the file exists and it is playable.
I uploaded my codes here to show this issue. Can you build it and check if the same error happen on your environment?
This is the step to see the issue
- run the app
- type 'r' key and then 'c' key
- You can see
player->load(args.fileName);
makes the error that is "error loading asset tracks: Cannot Open" several times (in my environment, around 10 times in while loop).
My environment is
MacOS verson 10.12.3
Xcode Version 8.3.2
openFrameworks of_v0.9.8_osx_release
Just tested your example, and it works.
Ubuntu 16.04
gcc 5.4.0
oF 0.9.8
Do you mean it works without any error message which you can see on the console? In my case the app works without crash but many error message: "error loading asset tracks: Cannot Open".
If it works without error on your environment, this issue may happen only on Mac, I guess the video file is still not ready to read in recordingComplete function.
I get a gstreamer error, but the video plays back just fine anyway.
The recoded video file is now complete.
[verbose] ofGstVideoPlayer: loadMovie(): loading "file:///home/tim/Documents/OF/addons/ofxVideoRecorder/ofxVideoRecorderIssue55/bin/data/testMovie2017-05-11-22-04-14-262.mov"
[verbose] ofGstUtils: startPipeline(): attaching callbacks
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from sink
[verbose] Pipeline is PREROLLING
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from sink
[[ error ] ofGstUtils: gstHandleMessage(): embedded video playback halted for plugin, module qtdemux0 reported: This file contains no playable streams.
error ] ofGstUtils: startPipeline(): unable to pause pipeline after 5s
[verbose] ofGstVideoPlayer: loadMovie(): loading "file:///home/tim/Documents/OF/addons/ofxVideoRecorder/ofxVideoRecorderIssue55/bin/data/testMovie2017-05-11-22-04-14-262.mov"
[verbose] ofGstUtils: startPipeline(): attaching callbacks
[verbose] Pipeline is PREROLLING
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from src_0
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from src_1
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from src
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from src
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from src
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from src
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from player
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from pulsesink1
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from pulsesink1
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from pulsesink1
[verbose] Pipeline is PREROLLED
[verbose] ofGstUtils: gstHandleMessage(): async done
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from player
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from pulsesink1
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from pulsesink1
[verbose] ofGstUtils: setSpeed(): speed changed to 1
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): async done
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): end of the stream
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from pulsesink1
[verbose] ofGstUtils: gstHandleMessage(): async done
[verbose] ofGstUtils: gstHandleMessage(): end of the stream
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from pulsesink1
[verbose] ofGstUtils: gstHandleMessage(): async done
[verbose] ofGstUtils: gstHandleMessage(): end of the stream
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from pulsesink1
[verbose] ofGstUtils: gstHandleMessage(): async done
[verbose] ofGstUtils: gstHandleMessage(): end of the stream
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from pulsesink1
[verbose] ofGstUtils: gstHandleMessage(): async done
[verbose] ofGstUtils: gstHandleMessage(): end of the stream
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from app_sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from pulsesink1
[verbose] ofGstUtils: gstHandleMessage(): async done
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from src
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from src
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from src_0
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from src_1
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from sink
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from src
The error "error loading asset tracks: Cannot Open" was printed in 188 line of ofAVFoundationVideoPlayer.m
NSLog(@"error loading asset tracks: %@", [error localizedDescription]);
So I added the codes below to check more detail of the error
NSLog(@"error1: %@", error);
NSString *errorString = [[[error userInfo] objectForKey:NSUnderlyingErrorKey] localizedDescription];
NSLog(@"error2: %@", errorString);
then these are printed out on the console
error1: Error Domain=AVFoundationErrorDomain Code=-11829 "Cannot Open" UserInfo={NSLocalizedFailureReason=This media may be damaged., NSLocalizedDescription=Cannot Open, NSURL=../../../data/movies/testMovie_2017-05-15-16-24-23-541.mov -- file:///Users/yuta-toga/Programs/of/of_v0.9.8_osx_release/apps/myApps/makimono/bin/makimonoDebug.app/Contents/Resources/, NSUnderlyingError=0x600000050aa0 {Error Domain=NSOSStatusErrorDomain Code=-12848 "(null)"}}
error2: The operation couldn’t be completed. (OSStatus error -12848.)
I'm still trying to find out the problem but just shared the error messages for now.