node.js - ffmpeg not working with piping to stdin -


i want stream file being uploaded ffmpeg. i'm using node.js , it's not working!

i ended testing piping input ffmpeg local file, , doens't work either. here's code:

var processvideo = function(videostream, resultpath) {   var cmdparams = [     '-i', '-',     '-y',     '-f', 'mp4',     '-vcodec', 'libx264',     '-vf', 'scale=-1:720',     '-f', 'mp4',     resultpath   ];   var ffmpeg = child_process.spawn('ffmpeg', cmdparams);    var data = '';   ffmpeg.stdout     .on('data', function(chunk) { data += chunk; })     .on('end', function() { console.log('result', data); });    var err = '';   ffmpeg.stderr     .on('data', function(chunk) { err += chunk; })     .on('end', function() { console.log('error', err);});   videostream.pipe(ffmpeg.stdin); };  processvideo(fs.createreadstream(pathtolocalmp4file), localpathtoresultfile); 

the output is

error ffmpeg version 2.8 copyright (c) 2000-2015 ffmpeg developers   built apple llvm version 7.0.0 (clang-700.1.76)   configuration: --prefix=/usr/local/cellar/ffmpeg/2.8 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libtheora --enable-vda   libavutil      54. 31.100 / 54. 31.100   libavcodec     56. 60.100 / 56. 60.100   libavformat    56. 40.101 / 56. 40.101   libavdevice    56.  4.100 / 56.  4.100   libavfilter     5. 40.101 /  5. 40.101   libavresample   2.  1.  0 /  2.  1.  0   libswscale      3.  1.101 /  3.  1.101   libswresample   1.  2.101 /  1.  2.101   libpostproc    53.  3.100 / 53.  3.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1e2802a00] stream 0, offset 0x20: partial file [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1e2802a00] not find codec parameters stream 0 (video: h264 (avc1 / 0x31637661), none, 1920x1080, 16242 kb/s): unspecified pixel format consider increasing value 'analyzeduration' , 'probesize' options input #0, mov,mp4,m4a,3gp,3g2,mj2, 'pipe:':   metadata:     major_brand     : mp42     minor_version   : 537134592     compatible_brands: mp42         creation_time   : 2015-12-26 12:47:49   duration: 00:00:04.00, bitrate: n/a     stream #0:0(und): video: h264 (avc1 / 0x31637661), none, 1920x1080, 16242 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 60k tbc (default)     metadata:       creation_time   : 2015-12-26 12:47:49       encoder         : avc coding     stream #0:1(und): audio: aac (mp4a / 0x6134706d), 32000 hz, mono, fltp, 46 kb/s (default)     metadata:       creation_time   : 2015-12-26 12:47:49 [buffer @ 0x7fd1e1c08e20] unable parse option value "-1" pixel format     last message repeated 1 times [buffer @ 0x7fd1e1c08e20] error setting option pix_fmt value -1. [graph 0 input stream 0:0 @ 0x7fd1e1c08f60] error applying options filter. error opening filters!  result  

i tried set -pix_fmt option, or -analyzeduration , -probesize suggested error code , this question, no avail.

however ffmpeg -i pathtolocalmp4file -y -f mp4 -pix_fmt yuv420p -vcodec libx264 -vf scale=-1:720 -f mp4 localpathtoresultfile works in terminal...

any idea??


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -