{"action":"created","issue":{"url":"https://api.github.com/repos/fluent-ffmpeg/node-fluent-ffmpeg/issues/423","labels_url":"https://api.github.com/repos/fluent-ffmpeg/node-fluent-ffmpeg/issues/423/labels{/name}","comments_url":"https://api.github.com/repos/fluent-ffmpeg/node-fluent-ffmpeg/issues/423/comments","events_url":"https://api.github.com/repos/fluent-ffmpeg/node-fluent-ffmpeg/issues/423/events","html_url":"https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/423","id":98375325,"number":423,"title":"Error: Output file #0 does not contain any stream","user":{"login":"BenBBear","id":7659710,"avatar_url":"https://avatars.githubusercontent.com/u/7659710?v=3","gravatar_id":"","url":"https://api.github.com/users/BenBBear","html_url":"https://github.com/BenBBear","followers_url":"https://api.github.com/users/BenBBear/followers","following_url":"https://api.github.com/users/BenBBear/following{/other_user}","gists_url":"https://api.github.com/users/BenBBear/gists{/gist_id}","starred_url":"https://api.github.com/users/BenBBear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenBBear/subscriptions","organizations_url":"https://api.github.com/users/BenBBear/orgs","repos_url":"https://api.github.com/users/BenBBear/repos","events_url":"https://api.github.com/users/BenBBear/events{/privacy}","received_events_url":"https://api.github.com/users/BenBBear/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/fluent-ffmpeg/node-fluent-ffmpeg/labels/Feedback%20needed","name":"Feedback needed","color":"02d7e1"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-07-31T11:50:13Z","updated_at":"2015-09-14T13:19:13Z","closed_at":null,"body":"When use filename as input and output, it works fine. But when use stream as input/output, error occurs.\r\n\r\nffmpeg version 2.6.2\r\n\r\n```js\r\nvar ffmpeg = require('fluent-ffmpeg');\r\nvar convert = function(input, output) {\r\n    var command = ffmpeg(input);\r\n\r\n    command\r\n        .videoCodec('libx264')\r\n        .toFormat('mp4')\r\n        .output(output)\r\n        .on('end', function() {\r\n            console.log('finish processing');\r\n        })\r\n        .run();    \r\n};\r\n\r\nvar fs = require('fs');\r\nvar path = require('path');\r\n\r\nvar input_file_name = path.resolve('./xxx.mov');\r\nvar output_file_name = path.resolve('./xxx.mp4');\r\nvar input = fs.createReadStream(input_file_name);\r\nvar output = fs.createWriteStream(output_file_name);\r\n\r\n\r\nconvert(input_file_name, output_file_name);  // works fine\r\n\r\nconvert(input, output); // error\r\nconvert(input, output_file_name);  // error\r\n/** error message\r\nevents.js:85\r\n      throw er; // Unhandled 'error' event\r\n            ^\r\nError: ffmpeg exited with code 1: Output file #0 does not contain any stream\r\n    at ChildProcess.<anonymous> (/path/to/node_modules/fluent-ffmpeg/lib/processor.js:167:22)\r\n    at ChildProcess.emit (events.js:110:17)\r\n    at Process.ChildProcess._handle.onexit (child_process.js:1074:12)\r\n**/\r\n\r\n\r\nconvert(input_file_name, output); // error\r\n/** error message \r\nevents.js:85\r\n      throw er; // Unhandled 'error' event\r\n            ^\r\nError: ffmpeg exited with code 1: Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument\r\n\r\n    at ChildProcess.<anonymous> (/path/to/node_modules/fluent-ffmpeg/lib/processor.js:167:22)\r\n    at ChildProcess.emit (events.js:110:17)\r\n    at Process.ChildProcess._handle.onexit (child_process.js:1074:12)\r\n**/\r\n\r\n```\r\n\r\nAny ideas to fix it?\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/fluent-ffmpeg/node-fluent-ffmpeg/issues/comments/140071765","html_url":"https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/423#issuecomment-140071765","issue_url":"https://api.github.com/repos/fluent-ffmpeg/node-fluent-ffmpeg/issues/423","id":140071765,"user":{"login":"elartix","id":1899626,"avatar_url":"https://avatars.githubusercontent.com/u/1899626?v=3","gravatar_id":"","url":"https://api.github.com/users/elartix","html_url":"https://github.com/elartix","followers_url":"https://api.github.com/users/elartix/followers","following_url":"https://api.github.com/users/elartix/following{/other_user}","gists_url":"https://api.github.com/users/elartix/gists{/gist_id}","starred_url":"https://api.github.com/users/elartix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elartix/subscriptions","organizations_url":"https://api.github.com/users/elartix/orgs","repos_url":"https://api.github.com/users/elartix/repos","events_url":"https://api.github.com/users/elartix/events{/privacy}","received_events_url":"https://api.github.com/users/elartix/received_events","type":"User","site_admin":false},"created_at":"2015-09-14T13:19:13Z","updated_at":"2015-09-14T13:19:13Z","body":"commandLine on start ('fluent-ffmpeg')\r\n```ffmpeg -ss 0 -i pipe:0 -i ./images/logo.png -y -filter_complex overlay=x=W-w-10:y=H-h-10[output] -map [output] -vcodec libx264 -r 15 -f mp4 -t 5 ./tmp/test.mp4```\r\n\r\n\r\n\r\nTried from terminal:\r\n```ffmpeg -ss 0 -i ./tmp/test.mp4 -i ./images/logo.png -y -filter_complex overlay=x=W-w-10:y=H-h-10[output] -map [output] -vcodec libx264 -r 15 -f mp4 -t 5 ./tmp/testout.mp4```\r\n\r\nResult is OK\r\n\r\n```ffmpeg version N-74369-g55a07cf Copyright (c) 2000-2015 the FFmpeg developers\r\n  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)\r\n  configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libdcadec --enable-libfreetype --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab\r\n  libavutil      54. 30.100 / 54. 30.100\r\n  libavcodec     56. 57.100 / 56. 57.100\r\n  libavformat    56. 40.101 / 56. 40.101\r\n  libavdevice    56.  4.100 / 56.  4.100\r\n  libavfilter     5. 32.100 /  5. 32.100\r\n  libavresample   2.  1.  0 /  2.  1.  0\r\n  libswscale      3.  1.101 /  3.  1.101\r\n  libswresample   1.  2.101 /  1.  2.101\r\n  libpostproc    53.  3.100 / 53.  3.100\r\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from './tmp/test.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf56.40.101\r\n  Duration: 00:00:05.05, start: 0.046440, bitrate: 508 kb/s\r\n    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 377 kb/s, 15 fps, 15 tbr, 15360 tbn, 30 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\n    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)\r\n    Metadata:\r\n      handler_name    : SoundHandler\r\nInput #1, png_pipe, from './images/logo.png':\r\n  Duration: N/A, bitrate: N/A\r\n    Stream #1:0: Video: png, rgba(pc), 154x56, 25 tbr, 25 tbn, 25 tbc\r\n[libx264 @ 0x23d7ac0] using SAR=1/1\r\n[libx264 @ 0x23d7ac0] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64\r\n[libx264 @ 0x23d7ac0] profile High, level 2.2\r\n[libx264 @ 0x23d7ac0] 264 - core 142 r2491 24e4fed - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=15 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00\r\nOutput #0, mp4, to './tmp/testout.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf56.40.101\r\n    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 15 fps, 15360 tbn, 15 tbc (default)\r\n    Metadata:\r\n      encoder         : Lavc56.57.100 libx264\r\nStream mapping:\r\n  Stream #0:0 (h264) -> overlay:main\r\n  Stream #1:0 (png) -> overlay:overlay\r\n  overlay -> Stream #0:0 (libx264)\r\nPress [q] to stop, [?] for help\r\nframe=   75 fps=0.0 q=-1.0 Lsize=     220kB time=00:00:04.86 bitrate= 370.4kbits/s dup=1 drop=0    \r\nvideo:219kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.701129%\r\n[libx264 @ 0x23d7ac0] frame I:1     Avg QP:22.59  size: 17601\r\n[libx264 @ 0x23d7ac0] frame P:44    Avg QP:23.73  size:  3627\r\n[libx264 @ 0x23d7ac0] frame B:30    Avg QP:27.02  size:  1530\r\n[libx264 @ 0x23d7ac0] consecutive B-frames: 37.3% 24.0% 12.0% 26.7%\r\n[libx264 @ 0x23d7ac0] mb I  I16..4:  9.0% 46.1% 44.9%\r\n[libx264 @ 0x23d7ac0] mb P  I16..4:  3.2%  7.9%  3.6%  P16..4: 20.6% 11.0%  3.8%  0.0%  0.0%    skip:49.9%\r\n[libx264 @ 0x23d7ac0] mb B  I16..4:  0.5%  1.0%  0.7%  B16..8: 23.6%  8.0%  1.6%  direct: 1.2%  skip:63.6%  L0:47.6% L1:42.5% BI: 9.9%\r\n[libx264 @ 0x23d7ac0] 8x8 transform intra:52.3% inter:67.9%\r\n[libx264 @ 0x23d7ac0] coded y,uvDC,uvAC intra: 49.1% 52.8% 19.5% inter: 10.3% 11.3% 0.8%\r\n[libx264 @ 0x23d7ac0] i16 v,h,dc,p: 36% 30%  8% 26%\r\n[libx264 @ 0x23d7ac0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 16% 26%  4%  4%  5%  4%  7%  5%\r\n[libx264 @ 0x23d7ac0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 16% 13%  4%  5%  6%  5%  6%  3%\r\n[libx264 @ 0x23d7ac0] i8c dc,h,v,p: 48% 16% 30%  6%\r\n[libx264 @ 0x23d7ac0] Weighted P-Frames: Y:0.0% UV:0.0%\r\n[libx264 @ 0x23d7ac0] ref P L0: 72.1% 13.8%  9.8%  4.3%\r\n[libx264 @ 0x23d7ac0] ref B L0: 91.6%  8.0%  0.3%\r\n[libx264 @ 0x23d7ac0] ref B L1: 98.6%  1.4%\r\n[libx264 @ 0x23d7ac0] kb/s:356.95```\r\n"}}