javascript - Node handbrakejs runs the code but doesn't output -


so have following code:

    var hbjs = require('handbrake-js');     var encodingoptions = {         input: media.file.path,         output:  media.targetdir+"helloworld.m4v",         quality: 17,         optimize: '',         encoder: "x264"     };     hbjs.spawn(encodingoptions)         .on("begin",function(){             console.log('begin')         })         .on("error", function(err){             // invalid user input, no video found etc             console.log('error!')         })         .on("progress", function(progress){             console.log(                 "percent complete: %s, eta: %s",                 progress.percentcomplete,                 progress.eta             );         })         .on("complete", function (complete) {             console.log('hello');         }) 

this code runs , once complete following console message:

complete 

now here odd part:

the progress output not displayed in console , when attempt find file there no file :s

there no errors in console , nothing indicating went wrong?

does have ideas of might be?

when debug complete function able go this , following output:

    [16:13:41] hb_init: starting libhb thread handbrake rev5474 (2014032499) - linux x86_64 - http://handbrake.fr 4 cpus detected opening uploads/codeschool_13281435328020903.mp4... [16:13:41] hb_scan: path=uploads/codeschool_13281435328020903.mp4, title_index=1 index_parse.c:191: indx_parse(): error opening uploads/codeschool_13281435328020903.mp4/bdmv/index.bdmv index_parse.c:191: indx_parse(): error opening uploads/codeschool_13281435328020903.mp4/bdmv/backup/index.bdmv bluray.c:2356: nav_get_title_list(uploads/codeschool_13281435328020903.mp4) failed [16:13:41] bd: not bd - trying stream/file instead libdvdnav: using dvdnav version 5.0.3 libdvdread: encrypted dvd support unavailable. ************************************************ **                                            ** **  no css library available. see             ** **  /usr/share/doc/libdvdread4/readme.css     ** **  more information.                     ** **                                            ** ************************************************ libdvdread:dvdopenfileudf:udffindfile /video_ts/video_ts.ifo failed libdvdread:dvdopenfileudf:udffindfile /video_ts/video_ts.bup failed libdvdread: can't open file video_ts.ifo. libdvdnav: vm: failed read video_ts.ifo [16:13:41] dvd: not dvd - trying stream/file instead input #0, mov,mp4,m4a,3gp,3g2,mj2, 'uploads/codeschool_13281435328020903.mp4':   metadata:     major_brand     : isom     minor_version   : 512     compatible_brands: isomiso2avc1mp41     creation_time   : 2014-05-09 02:55:07     title           : shaping_up_with_angular_js_level_2a     album_artist    : oliver tosh     encoder         : lavf54.6.100     description     : video shaping_up_with_angular_js_level_2a   duration: 00:04:18.10, start: 0.000000, bitrate: 1762 kb/s     stream #0.0(eng): video: h264 (main), yuvj420p, 1280x720, 1547 kb/s, 29.97 fps, 30 tbr, 30 tbn, 60 tbc     metadata:       creation_time   : 2014-05-09 02:55:07     stream #0.1(eng): audio: aac, 48000 hz, stereo, fltp, 127 kb/s     metadata:       creation_time   : 2014-05-09 02:55:07     stream #0.2(und): data: rtp  / 0x20707472, 72 kb/s     metadata:       creation_time   : 2014-05-09 03:46:24     stream #0.3(und): data: rtp  / 0x20707472, 9 kb/s     metadata:       creation_time   : 2014-05-09 03:46:24 [16:13:42] scan: decoding previews title 1 [16:13:42] scan: audio 0x1: aac, rate=48000hz, bitrate=127426 english (aac) (2.0 ch)  scanning title 1 of 1, preview 2, 20.00 %[16:13:42] scan: 10 previews, 1280x720, 29.970 fps, autocrop = 0/0/0/0, aspect 16:9, par 1:1  scanning title 1 of 1, preview 10, 100.00 %[16:13:42] libhb: scan thread found 1 valid title(s) + title 1:   + stream: uploads/codeschool_13281435328020903.mp4   + duration: 00:04:18   + size: 1280x720, pixel aspect: 1/1, display aspect: 1.78, 29.970 fps   + autocrop: 0/0/0/0   + chapters:     + 1: cells 0->0, 0 blocks, duration 00:04:18   + audio tracks:     + 1, english (aac) (2.0 ch) (iso639-2: eng)   + subtitle tracks: [16:13:42] 1 job(s) process [16:13:42] starting job [16:13:42] work: mixdown not specified, track 1 setting mixdown stereo [16:13:42] work: bitrate not specified, track 1 setting bitrate 160 kbps [16:13:42] sync: expecting 7735 video frames error: invalid audio codec: 0x100 [16:13:42] render: lost time: 0 (0 frames) [16:13:42] render: gained time: 0 (0 frames) (0 not accounted for) [16:13:42] libhb: work result = 0  encode done! handbrake has exited. 

might worth trying add missing parameters? use handbrake-js on linux system , performs expected these encoding options:

 var encodingoptions = {         input:  inputfile,         output: outputfile,         quality: 17,         optimize: '',         encoder: "x264"     } 

then, call:

hbjs.spawn(encodingoptions) .on('begin', ...)...; 

btw, need listen on.end event, , not on.complete. documentation:

"end" fired on successful completion of encoding task. follows begin event, progress in between.

"complete" fired when handbrakecli exited cleanly. not mean encode completed planned..


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -