Ahmed Sharief
2018-08-24 12:05:40 UTC
I am trying to create thumbnails from an amazon s3 bucket signed url. I am
able to generate thumbnails when i run the command in terminal
ffmpeg -ss 00:00:02 -i "https://test-s3-bucket.s3.ap-south-1.amazonaws.com/user_gallery_assets/5b6936069ac2bf0602085367/gallery/images/5b7be08527641dee8c1f8134.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=xxxxxxxxx%2F20180821%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20180821T095101Z&X-Amz-Expires=900&X-Amz-Signature=d7f81f4eed3d6c87c04dc1b0ad06beeb946afa33d417585f57fad72aeadb3ac0&X-Amz-SignedHeaders=host" -vframes 1 -q:v 2 -f image2 output.jpg
I am running the above command in terminal and its working fine but when i
try to implement the same in node js its showing "no such file or directory
error". Though i am encoding the url with double quotes then also its
showign same error. Here is my node js code....
function uploadThumbNailForVideo(obj,url, thumb_url){
return new Promise((resolve, reject) => resolve(url))
.then((url) => awsHelper.getImage(url))
.then((result) => {
var resUrl = "\""+result+"\"";
var args = [
'-i', resUrl,
'-ss', '00:00:02',
'-vframes', '1',
'-f','image2',
'output.jpg'
]
//console.log(args)
var ffmpeg = require('child_process').spawn('ffmpeg', args);
ffmpeg.on('error', function (err) {
console.log(err);
});
ffmpeg.on('close', function (code) {
});
ffmpeg.stderr.on('data', function (data) {
var tData = data.toString('utf8');
var a = tData.split('\n');
console.log("A",a);
});
ffmpeg.stdout.on('data', function (data) {
//
});
});
}
and i am getting the following error
A [ 'ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg
developers' ]
A [ '',
' built with Apple LLVM version 9.1.0 (clang-902.0.39.2)',
' configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-
shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --
enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-
gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-
opencl --enable-videotoolbox --disable-lzma',
' libavutil 56. 14.100 / 56. 14.100',
' libavcodec 58. 18.100 / 58. 18.100',
' libavformat 58. 12.100 / 58. 12.100',
' libavdevice 58. 3.100 / 58. 3.100',
' libavfilter 7. 16.100 / 7. 16.100',
' libavresample 4. 0. 0 / 4. 0. 0',
' libswscale 5. 1.100 / 5. 1.100',
' libswresample 3. 1.100 / 3. 1.100',
' libpostproc 55. 1.100 / 55. 1.100',
'"https://test-s3-bucket.s3.ap-south-1.amazonaws.com/user_gallery_assets/5b6936069ac2bf0602085367/gallery/images/5b7be08527641dee8c1f8134.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=xxxxxxxxx%2F20180821%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20180821T095101Z&X-Amz-Expires=900&X-Amz-Signature=d7f81f4eed3d6c87c04dc1b0ad06beeb946afa33d417585f57fad72aeadb3ac0&X-Amz-SignedHeaders=host": No such file or directory',
'' ]
ffmpeg exited with code 1
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/b2febc66-5e22-4abe-8a8f-85f300df4f57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
able to generate thumbnails when i run the command in terminal
ffmpeg -ss 00:00:02 -i "https://test-s3-bucket.s3.ap-south-1.amazonaws.com/user_gallery_assets/5b6936069ac2bf0602085367/gallery/images/5b7be08527641dee8c1f8134.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=xxxxxxxxx%2F20180821%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20180821T095101Z&X-Amz-Expires=900&X-Amz-Signature=d7f81f4eed3d6c87c04dc1b0ad06beeb946afa33d417585f57fad72aeadb3ac0&X-Amz-SignedHeaders=host" -vframes 1 -q:v 2 -f image2 output.jpg
I am running the above command in terminal and its working fine but when i
try to implement the same in node js its showing "no such file or directory
error". Though i am encoding the url with double quotes then also its
showign same error. Here is my node js code....
function uploadThumbNailForVideo(obj,url, thumb_url){
return new Promise((resolve, reject) => resolve(url))
.then((url) => awsHelper.getImage(url))
.then((result) => {
var resUrl = "\""+result+"\"";
var args = [
'-i', resUrl,
'-ss', '00:00:02',
'-vframes', '1',
'-f','image2',
'output.jpg'
]
//console.log(args)
var ffmpeg = require('child_process').spawn('ffmpeg', args);
ffmpeg.on('error', function (err) {
console.log(err);
});
ffmpeg.on('close', function (code) {
});
ffmpeg.stderr.on('data', function (data) {
var tData = data.toString('utf8');
var a = tData.split('\n');
console.log("A",a);
});
ffmpeg.stdout.on('data', function (data) {
//
});
});
}
and i am getting the following error
A [ 'ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg
developers' ]
A [ '',
' built with Apple LLVM version 9.1.0 (clang-902.0.39.2)',
' configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-
shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --
enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-
gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-
opencl --enable-videotoolbox --disable-lzma',
' libavutil 56. 14.100 / 56. 14.100',
' libavcodec 58. 18.100 / 58. 18.100',
' libavformat 58. 12.100 / 58. 12.100',
' libavdevice 58. 3.100 / 58. 3.100',
' libavfilter 7. 16.100 / 7. 16.100',
' libavresample 4. 0. 0 / 4. 0. 0',
' libswscale 5. 1.100 / 5. 1.100',
' libswresample 3. 1.100 / 3. 1.100',
' libpostproc 55. 1.100 / 55. 1.100',
'"https://test-s3-bucket.s3.ap-south-1.amazonaws.com/user_gallery_assets/5b6936069ac2bf0602085367/gallery/images/5b7be08527641dee8c1f8134.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=xxxxxxxxx%2F20180821%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20180821T095101Z&X-Amz-Expires=900&X-Amz-Signature=d7f81f4eed3d6c87c04dc1b0ad06beeb946afa33d417585f57fad72aeadb3ac0&X-Amz-SignedHeaders=host": No such file or directory',
'' ]
ffmpeg exited with code 1
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/b2febc66-5e22-4abe-8a8f-85f300df4f57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.