Skip to content

Commit

Permalink
convert进度
Browse files Browse the repository at this point in the history
  • Loading branch information
luohao committed Jan 18, 2021
1 parent 0a220e9 commit 485cbf5
Show file tree
Hide file tree
Showing 97 changed files with 35 additions and 13 deletions.
File renamed without changes.
22 changes: 14 additions & 8 deletions src/example/eg.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { PPT2video } = require('../ppt2pdf.js');
const path = require('path');
const ppt2video = new PPT2video({
pptPath: path.resolve('../doc/test.pptx'),
pptPath: path.resolve('../doc/《摆渡船阅读》四下样本.pptx'),
animate: {
use: true,
// type: 'vertclose',
Expand All @@ -22,13 +22,19 @@ const videoFolder = path.resolve(__dirname, '../doc/video');
// }).catch(err => {
// console.log(err);
// });

ppt2video.concatVideos(videoFolder, path.dirname(videoFolder), {
resultName: 'hhhhhhhresult.mp4'
}, (a, b, c) =>{
console.log(a, b, c);
ppt2video.convert(percent => {
console.log(percent)
}).then(data => {
console.log(data)
console.log(data);
}).catch(err => {
console.log(err);
});
})
// ppt2video.concatVideos(videoFolder, path.dirname(videoFolder), {
// resultName: 'hhhhhhhresult.mp4'
// }, (a, b, c) =>{
// console.log(a, b, c);
// }).then(data => {
// console.log(data)
// }).catch(err => {
// console.log(err);
// });
Binary file added src/example/result/result.mp4
Binary file not shown.
2 changes: 1 addition & 1 deletion src/example/temp/ppt2video/filterScript.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[0:v]split[v0][v0copy];[v0copy]trim=0:1[v01];[1:v]split[v1][v1copy];[v1copy]trim=0:1[v11];[v11]split[v110][v111];[2:v]split[v2][v2copy];[v2copy]trim=0:1[v21];[v21]split[v210][v211];[3:v]split[v3][v3copy];[v3copy]trim=0:1[v31];[v31]split[v310][v311];[4:v]split[v4][v4copy];[v4copy]trim=0:1[v41];[v41]split[v410][v411];[5:v]split[v5][v5copy];[v5copy]trim=0:1[v51];[v51]split[v510][v511];[6:v]split[v6][v6copy];[v6copy]trim=0:1[v61];[v61]split[v610][v611];[7:v]split[v7][v7copy];[v7copy]trim=0:1[v71];[v71]split[v710][v711];[8:v]split[v8][v8copy];[v8copy]trim=0:1[v81];[v01][v110]xfade=transition=fade:duration=1:offset=0[vt0];[v111][v210]xfade=transition=wipeleft:duration=1:offset=0[vt1];[v211][v310]xfade=transition=wiperight:duration=1:offset=0[vt2];[v311][v410]xfade=transition=wipeup:duration=1:offset=0[vt3];[v411][v510]xfade=transition=wipedown:duration=1:offset=0[vt4];[v511][v610]xfade=transition=slideleft:duration=1:offset=0[vt5];[v611][v710]xfade=transition=slideright:duration=1:offset=0[vt6];[v711][v81]xfade=transition=slideup:duration=1:offset=0[vt7];[v0][vt0][v1][vt1][v2][vt2][v3][vt3][v4][vt4][v5][vt5][v6][vt6][v7][vt7][v8]concat=n=17[video];[9:a]atrim=0:1[asilent];[asilent]asplit=8[asilent0][asilent1][asilent2][asilent3][asilent4][asilent5][asilent6][asilent7];[0:a][asilent0][1:a][asilent1][2:a][asilent2][3:a][asilent3][4:a][asilent4][5:a][asilent5][6:a][asilent6][7:a][asilent7][8:a]concat=n=17:v=0:a=1[audio]
[0:v]split[v0][v0copy];[v0copy]trim=0:1[v01];[1:v]split[v1][v1copy];[v1copy]trim=0:1[v11];[v11]split[v110][v111];[2:v]split[v2][v2copy];[v2copy]trim=0:1[v21];[v21]split[v210][v211];[3:v]split[v3][v3copy];[v3copy]trim=0:1[v31];[v31]split[v310][v311];[4:v]split[v4][v4copy];[v4copy]trim=0:1[v41];[v41]split[v410][v411];[5:v]split[v5][v5copy];[v5copy]trim=0:1[v51];[v51]split[v510][v511];[6:v]split[v6][v6copy];[v6copy]trim=0:1[v61];[v61]split[v610][v611];[7:v]split[v7][v7copy];[v7copy]trim=0:1[v71];[v71]split[v710][v711];[8:v]split[v8][v8copy];[v8copy]trim=0:1[v81];[v81]split[v810][v811];[9:v]split[v9][v9copy];[v9copy]trim=0:1[v91];[v91]split[v910][v911];[10:v]split[v10][v10copy];[v10copy]trim=0:1[v101];[v101]split[v1010][v1011];[11:v]split[v11][v11copy];[v11copy]trim=0:1[v111];[v111]split[v1110][v1111];[12:v]split[v12][v12copy];[v12copy]trim=0:1[v121];[v121]split[v1210][v1211];[13:v]split[v13][v13copy];[v13copy]trim=0:1[v131];[v131]split[v1310][v1311];[14:v]split[v14][v14copy];[v14copy]trim=0:1[v141];[v141]split[v1410][v1411];[15:v]split[v15][v15copy];[v15copy]trim=0:1[v151];[v151]split[v1510][v1511];[16:v]split[v16][v16copy];[v16copy]trim=0:1[v161];[v161]split[v1610][v1611];[17:v]split[v17][v17copy];[v17copy]trim=0:1[v171];[v171]split[v1710][v1711];[18:v]split[v18][v18copy];[v18copy]trim=0:1[v181];[v181]split[v1810][v1811];[19:v]split[v19][v19copy];[v19copy]trim=0:1[v191];[v191]split[v1910][v1911];[20:v]split[v20][v20copy];[v20copy]trim=0:1[v201];[v201]split[v2010][v2011];[21:v]split[v21][v21copy];[v21copy]trim=0:1[v211];[v211]split[v2110][v2111];[22:v]split[v22][v22copy];[v22copy]trim=0:1[v221];[v221]split[v2210][v2211];[23:v]split[v23][v23copy];[v23copy]trim=0:1[v231];[v231]split[v2310][v2311];[24:v]split[v24][v24copy];[v24copy]trim=0:1[v241];[v241]split[v2410][v2411];[25:v]split[v25][v25copy];[v25copy]trim=0:1[v251];[v251]split[v2510][v2511];[26:v]split[v26][v26copy];[v26copy]trim=0:1[v261];[v261]split[v2610][v2611];[27:v]split[v27][v27copy];[v27copy]trim=0:1[v271];[v271]split[v2710][v2711];[28:v]split[v28][v28copy];[v28copy]trim=0:1[v281];[v281]split[v2810][v2811];[29:v]split[v29][v29copy];[v29copy]trim=0:1[v291];[v291]split[v2910][v2911];[30:v]split[v30][v30copy];[v30copy]trim=0:1[v301];[v301]split[v3010][v3011];[31:v]split[v31][v31copy];[v31copy]trim=0:1[v311];[v311]split[v3110][v3111];[32:v]split[v32][v32copy];[v32copy]trim=0:1[v321];[v321]split[v3210][v3211];[33:v]split[v33][v33copy];[v33copy]trim=0:1[v331];[v331]split[v3310][v3311];[34:v]split[v34][v34copy];[v34copy]trim=0:1[v341];[v341]split[v3410][v3411];[35:v]split[v35][v35copy];[v35copy]trim=0:1[v351];[v351]split[v3510][v3511];[36:v]split[v36][v36copy];[v36copy]trim=0:1[v361];[v361]split[v3610][v3611];[37:v]split[v37][v37copy];[v37copy]trim=0:1[v371];[v371]split[v3710][v3711];[38:v]split[v38][v38copy];[v38copy]trim=0:1[v381];[v381]split[v3810][v3811];[39:v]split[v39][v39copy];[v39copy]trim=0:1[v391];[v391]split[v3910][v3911];[40:v]split[v40][v40copy];[v40copy]trim=0:1[v401];[v401]split[v4010][v4011];[41:v]split[v41][v41copy];[v41copy]trim=0:1[v411];[v411]split[v4110][v4111];[42:v]split[v42][v42copy];[v42copy]trim=0:1[v421];[v421]split[v4210][v4211];[43:v]split[v43][v43copy];[v43copy]trim=0:1[v431];[v431]split[v4310][v4311];[44:v]split[v44][v44copy];[v44copy]trim=0:1[v441];[v441]split[v4410][v4411];[45:v]split[v45][v45copy];[v45copy]trim=0:1[v451];[v01][v110]xfade=transition=fade:duration=1:offset=0[vt0];[v111][v210]xfade=transition=wipeleft:duration=1:offset=0[vt1];[v211][v310]xfade=transition=wiperight:duration=1:offset=0[vt2];[v311][v410]xfade=transition=wipeup:duration=1:offset=0[vt3];[v411][v510]xfade=transition=wipedown:duration=1:offset=0[vt4];[v511][v610]xfade=transition=slideleft:duration=1:offset=0[vt5];[v611][v710]xfade=transition=slideright:duration=1:offset=0[vt6];[v711][v810]xfade=transition=slideup:duration=1:offset=0[vt7];[v811][v910]xfade=transition=slidedown:duration=1:offset=0[vt8];[v911][v1010]xfade=transition=circlecrop:duration=1:offset=0[vt9];[v1011][v1110]xfade=transition=rectcrop:duration=1:offset=0[vt10];[v1111][v1210]xfade=transition=distance:duration=1:offset=0[vt11];[v1211][v1310]xfade=transition=fadeblack:duration=1:offset=0[vt12];[v1311][v1410]xfade=transition=fadewhite:duration=1:offset=0[vt13];[v1411][v1510]xfade=transition=radial:duration=1:offset=0[vt14];[v1511][v1610]xfade=transition=smoothleft:duration=1:offset=0[vt15];[v1611][v1710]xfade=transition=smoothright:duration=1:offset=0[vt16];[v1711][v1810]xfade=transition=smoothup:duration=1:offset=0[vt17];[v1811][v1910]xfade=transition=smoothdown:duration=1:offset=0[vt18];[v1911][v2010]xfade=transition=circleopen:duration=1:offset=0[vt19];[v2011][v2110]xfade=transition=circleclose:duration=1:offset=0[vt20];[v2111][v2210]xfade=transition=vertopen:duration=1:offset=0[vt21];[v2211][v2310]xfade=transition=vertclose:duration=1:offset=0[vt22];[v2311][v2410]xfade=transition=horzopen:duration=1:offset=0[vt23];[v2411][v2510]xfade=transition=horzclose:duration=1:offset=0[vt24];[v2511][v2610]xfade=transition=dissolve:duration=1:offset=0[vt25];[v2611][v2710]xfade=transition=pixelize:duration=1:offset=0[vt26];[v2711][v2810]xfade=transition=diagtl:duration=1:offset=0[vt27];[v2811][v2910]xfade=transition=diagtr:duration=1:offset=0[vt28];[v2911][v3010]xfade=transition=diagbl:duration=1:offset=0[vt29];[v3011][v3110]xfade=transition=diagbr:duration=1:offset=0[vt30];[v3111][v3210]xfade=transition=fade:duration=1:offset=0[vt31];[v3211][v3310]xfade=transition=wipeleft:duration=1:offset=0[vt32];[v3311][v3410]xfade=transition=wiperight:duration=1:offset=0[vt33];[v3411][v3510]xfade=transition=wipeup:duration=1:offset=0[vt34];[v3511][v3610]xfade=transition=wipedown:duration=1:offset=0[vt35];[v3611][v3710]xfade=transition=slideleft:duration=1:offset=0[vt36];[v3711][v3810]xfade=transition=slideright:duration=1:offset=0[vt37];[v3811][v3910]xfade=transition=slideup:duration=1:offset=0[vt38];[v3911][v4010]xfade=transition=slidedown:duration=1:offset=0[vt39];[v4011][v4110]xfade=transition=circlecrop:duration=1:offset=0[vt40];[v4111][v4210]xfade=transition=rectcrop:duration=1:offset=0[vt41];[v4211][v4310]xfade=transition=distance:duration=1:offset=0[vt42];[v4311][v4410]xfade=transition=fadeblack:duration=1:offset=0[vt43];[v4411][v451]xfade=transition=fadewhite:duration=1:offset=0[vt44];[v0][vt0][v1][vt1][v2][vt2][v3][vt3][v4][vt4][v5][vt5][v6][vt6][v7][vt7][v8][vt8][v9][vt9][v10][vt10][v11][vt11][v12][vt12][v13][vt13][v14][vt14][v15][vt15][v16][vt16][v17][vt17][v18][vt18][v19][vt19][v20][vt20][v21][vt21][v22][vt22][v23][vt23][v24][vt24][v25][vt25][v26][vt26][v27][vt27][v28][vt28][v29][vt29][v30][vt30][v31][vt31][v32][vt32][v33][vt33][v34][vt34][v35][vt35][v36][vt36][v37][vt37][v38][vt38][v39][vt39][v40][vt40][v41][vt41][v42][vt42][v43][vt43][v44][vt44][v45]concat=n=91[video];[46:a]atrim=0:1[asilent];[asilent]asplit=45[asilent0][asilent1][asilent2][asilent3][asilent4][asilent5][asilent6][asilent7][asilent8][asilent9][asilent10][asilent11][asilent12][asilent13][asilent14][asilent15][asilent16][asilent17][asilent18][asilent19][asilent20][asilent21][asilent22][asilent23][asilent24][asilent25][asilent26][asilent27][asilent28][asilent29][asilent30][asilent31][asilent32][asilent33][asilent34][asilent35][asilent36][asilent37][asilent38][asilent39][asilent40][asilent41][asilent42][asilent43][asilent44];[0:a][asilent0][1:a][asilent1][2:a][asilent2][3:a][asilent3][4:a][asilent4][5:a][asilent5][6:a][asilent6][7:a][asilent7][8:a][asilent8][9:a][asilent9][10:a][asilent10][11:a][asilent11][12:a][asilent12][13:a][asilent13][14:a][asilent14][15:a][asilent15][16:a][asilent16][17:a][asilent17][18:a][asilent18][19:a][asilent19][20:a][asilent20][21:a][asilent21][22:a][asilent22][23:a][asilent23][24:a][asilent24][25:a][asilent25][26:a][asilent26][27:a][asilent27][28:a][asilent28][29:a][asilent29][30:a][asilent30][31:a][asilent31][32:a][asilent32][33:a][asilent33][34:a][asilent34][35:a][asilent35][36:a][asilent36][37:a][asilent37][38:a][asilent38][39:a][asilent39][40:a][asilent40][41:a][asilent41][42:a][asilent42][43:a][asilent43][44:a][asilent44][45:a]concat=n=91:v=0:a=1[audio]
Binary file added src/example/temp/ppt2video/img/幻灯片1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片10.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片11.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片12.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片13.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片14.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片15.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片16.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片17.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片18.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片19.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片20.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片21.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片22.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片23.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片24.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片25.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片26.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片27.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片28.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片29.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片3.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片30.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片31.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/example/temp/ppt2video/img/幻灯片32.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片33.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片34.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片35.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片36.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片37.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片38.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片39.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片4.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片40.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片41.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片42.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片43.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片44.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片45.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片46.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片5.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片6.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片7.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片8.PNG
Binary file added src/example/temp/ppt2video/img/幻灯片9.PNG
Binary file added src/example/temp/ppt2video/video/幻灯片1.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片10.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片11.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片12.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片13.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片14.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片15.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片16.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片17.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片18.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片19.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片2.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片20.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片21.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片22.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片23.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片24.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片25.mp4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片28.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片29.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片3.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片30.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片31.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片32.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片33.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片34.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片35.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片36.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片37.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片38.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片39.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片4.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片40.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片41.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片42.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片43.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片44.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片45.mp4
Binary file not shown.
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片5.mp4
Binary file not shown.
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片7.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片8.mp4
Binary file not shown.
Binary file added src/example/temp/ppt2video/video/幻灯片9.mp4
Binary file not shown.
24 changes: 20 additions & 4 deletions src/ppt2pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,29 @@ class PPT2video {
// tmpdir
this.mkCleanTempDir();
}
convert() {
convert(progressCb) {
return new Promise(async (resolve, reject) => {
try {
const { pptPath, audioFolder, resultFolder } = this.config;
// ppt -> img
const imgFolder = await this.getSlideImgs(pptPath);
// img + audio -> video
const videoFolder = await this.getSlideVideos(imgFolder, audioFolder);
const getSlideVideosScale = 0.42;
const concatVideosScale = 1 - getSlideVideosScale;
const videoFolder = await this.getSlideVideos(imgFolder, audioFolder, '', (percent, cur, total) => {
if (progressCb && progressCb instanceof Function) {
progressCb(percent * getSlideVideosScale);
}
});
// video + animate + video... -> video
const videoName = path.basename(pptPath, path.extname(pptPath)) + '.mp4';
const resultPath = await this.concatVideos(videoFolder, resultFolder, videoName);
const resultPath = await this.concatVideos(videoFolder, resultFolder, {
resultName: videoName
}, (percent, cur, total) => {
if (progressCb && progressCb instanceof Function) {
progressCb(percent * concatVideosScale + getSlideVideosScale * 100);
}
});
resolve(resultPath);
} catch(err) {
reject(err);
Expand Down Expand Up @@ -104,7 +116,7 @@ class PPT2video {
* @param {String} videoFolder 输出目录
* @returns {String} 输出目录
*/
getSlideVideos(imgFolder, audioFolder, videoFolder) {
getSlideVideos(imgFolder, audioFolder, videoFolder, progressCb) {
return new Promise(async (resolve, reject) => {
if (!existPath(imgFolder)) {
imgFolder = this.tmpdir.img;
Expand All @@ -125,6 +137,10 @@ class PPT2video {
/**generate audio TODO//////////////////////////////////////// */
// TODO:选出跟图片对应的音频
await this.img2video(imgPath, audioPath, videoFolder);
if (progressCb && progressCb instanceof Function) {
const percent = Math.round((i + 1) / imgList.length * 10000) / 100;
progressCb(percent, i + 1, imgList.length);
}
}
resolve(videoFolder);
} catch(err) {
Expand Down

0 comments on commit 485cbf5

Please sign in to comment.