I am trying to convert a Quicktime movie to MPEG4 with the following code:
var command = new ffmpegCommand(inputFile);
command
.on('start', function(command) {
console.log('Start: ', command);
})
.withAudioCodec('copy')
.withVideoCodec('copy')
.output(outputFile)
.on('error', function(err) {
console.log('An error occurred: ' + err.message, err);
})
.on('end', function() {
console.log('Processing finished !');
callback();
});
command.run();
When I run it I get the following output:
Start: ffmpeg -i /data/app-3213/users/123241123/123241123-cf9e19c940d461cd504c428f74a5aab8cf80fa25.MOV -y -acodec copy -vcodec copy /Library/WebServer/Documents/cache/app-3213/media/video/123241123-cf9e19c940d461cd504c428f74a5aab8cf80fa25.mp4
An error occurred: ffmpeg exited with code 1: /data/app-3213/users/123241123/123241123-cf9e19c940d461cd504c428f74a5aab8cf80fa25.MOV: Invalid data found when processing input
[Error: ffmpeg exited with code 1: /data/app-3213/users/123241123/123241123-cf9e19c940d461cd504c428f74a5aab8cf80fa25.MOV: Invalid data found when processing input
]
At the same time, when I copy and paste the ffmpeg command, as displayed above, straight from the command line it succeeds. Do you have any suggestions as to what I could be checking?
Further analysis showed it was a bug on my side (as I had assumed). Basically a file move hadn't completed prior to the conversion process, so I was trying to convert a file that did not yet exist a the path.
For anyone else, I got a bit more clarification once I updated the on('error') to:
.on('error', function(err, stdout, stderr) {
console.log('An error occurred: ' + err.message, err, stderr);
})
Most helpful comment
Further analysis showed it was a bug on my side (as I had assumed). Basically a file move hadn't completed prior to the conversion process, so I was trying to convert a file that did not yet exist a the path.
For anyone else, I got a bit more clarification once I updated the on('error') to: