App was throwing error during filmout. Re-wrote the resizing logic so that if it can't find dimensions in the info, don't resize the image. This may lead to squashing, as I've seen in frameloom, but I suspect this problem is with the UI and the superfluous "USE FILE" button.

This commit is contained in:
mmcwilliams 2019-08-04 17:20:45 -04:00
parent c5f3c72f73
commit 5695bfd645
9 changed files with 68 additions and 48 deletions

View File

@ -14,11 +14,11 @@ function padded_frame(i) {
return str; return str;
} }
async function frame(state, light) { async function frame(state, light) {
let frame = state.frame; const frameNum = state.frame;
let video = state.path; const video = state.path;
let w = state.info.width; const w = state.info.width;
let h = state.info.height; const h = state.info.height;
let padded = padded_frame(frame); const padded = padded_frame(frameNum);
let ext = 'tif'; let ext = 'tif';
let rgb = light.color; let rgb = light.color;
let tmpoutput; let tmpoutput;
@ -26,16 +26,20 @@ async function frame(state, light) {
let output; let output;
let cmd2; let cmd2;
let output2; let output2;
console.dir(state); let scale = '';
if (w && h) {
scale = `,scale=${w}:${h}`;
}
//console.dir(state)
//if (system.platform !== 'nix') { //if (system.platform !== 'nix') {
ext = 'png'; ext = 'png';
//} //}
tmpoutput = path_1.join(TMPDIR, `export-${padded}.${ext}`);
rgb = rgb.map((e) => { rgb = rgb.map((e) => {
return parseInt(e); return parseInt(e);
}); });
tmpoutput = path_1.join(TMPDIR, `export-${padded}.${ext}`); //
//,scale=${w}:${h} cmd = `ffmpeg -y -i "${video}" -vf "select='gte(n\\,${frameNum})'${scale}" -vframes 1 -compression_algo raw -pix_fmt rgb24 "${tmpoutput}"`;
cmd = `ffmpeg -y -i "${video}" -vf "select='gte(n\\,${frame})'" -vframes 1 -compression_algo raw -pix_fmt rgb24 "${tmpoutput}"`;
cmd2 = `convert "${tmpoutput}" -resize ${w}x${h} -size ${w}x${h} xc:"rgb(${rgb[0]},${rgb[1]},${rgb[2]})" +swap -compose Darken -composite "${tmpoutput}"`; cmd2 = `convert "${tmpoutput}" -resize ${w}x${h} -size ${w}x${h} xc:"rgb(${rgb[0]},${rgb[1]},${rgb[2]})" +swap -compose Darken -composite "${tmpoutput}"`;
//ffmpeg -i "${video}" -ss 00:00:07.000 -vframes 1 "export-${time}.jpg" //ffmpeg -i "${video}" -ss 00:00:07.000 -vframes 1 "export-${time}.jpg"
//ffmpeg -i "${video}" -compression_algo raw -pix_fmt rgb24 "export-%05d.tiff" //ffmpeg -i "${video}" -compression_algo raw -pix_fmt rgb24 "export-%05d.tiff"

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ffmpeg/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,+BAA4B;AAC5B,uCAA0D;AAC1D,+BAA4B;AAI5B,IAAI,MAAM,GAAS,EAAE,CAAC;AACtB,IAAI,MAAe,CAAC;AAEpB,SAAS,YAAY,CAAE,CAAU;IAChC,IAAI,GAAG,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC;IAC1B,IAAI,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;QACjC,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;KAChB;IACD,OAAO,GAAG,CAAC;AACZ,CAAC;AAED,KAAK,UAAU,KAAK,CAAE,KAAW,EAAE,KAAW;IAC7C,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;IACvB,IAAI,KAAK,GAAG,KAAK,CAAC,IAAI,CAAA;IACtB,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAA;IACxB,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAA;IACzB,IAAI,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;IAChC,IAAI,GAAG,GAAG,KAAK,CAAA;IACf,IAAI,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC;IACtB,IAAI,SAAS,CAAC;IACd,IAAI,GAAG,CAAC;IACR,IAA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AC;KAClC;IAAC,OAAO,GAAG,EAAE;QACb,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;KACjD;IAED,IAAI,CAAC,UAAU,EAAE;QAChB,IAAI;YACH,MAAM,gBAAK,CAAC,MAAM,CAAC,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,kBAAkB,MAAM,EAAE,CAAC,CAAC;SACxC;QAAC,OAAO,GAAG,EAAE;YACb,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;SAC7C;KACD;IACD,IAAI;QACH,MAAM,QAAQ,EAAE,CAAC;KACjB;IAAC,OAAO,GAAG,EAAE;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KACnB;AACF,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,GAAS,EAAE,EAAE;IAC9B,MAAM,GAAG,GAAG,CAAC;IACb,MAAM,GAAG,WAAI,CAAC,MAAM,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IAE3C,QAAQ,EAAE,CAAC;IAEX,OAAO;QACN,MAAM;QACN,KAAK;QACL,KAAK;QACL,QAAQ;KACR,CAAA;AACF,CAAC,CAAA"}

2
app/package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "mcopy-app", "name": "mcopy-app",
"version": "1.4.16", "version": "1.4.17",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -14,11 +14,11 @@ function padded_frame(i) {
return str; return str;
} }
async function frame(state, light) { async function frame(state, light) {
let frame = state.frame; const frameNum = state.frame;
let video = state.path; const video = state.path;
let w = state.info.width; const w = state.info.width;
let h = state.info.height; const h = state.info.height;
let padded = padded_frame(frame); const padded = padded_frame(frameNum);
let ext = 'tif'; let ext = 'tif';
let rgb = light.color; let rgb = light.color;
let tmpoutput; let tmpoutput;
@ -26,16 +26,20 @@ async function frame(state, light) {
let output; let output;
let cmd2; let cmd2;
let output2; let output2;
console.dir(state); let scale = '';
if (w && h) {
scale = `,scale=${w}:${h}`;
}
//console.dir(state)
//if (system.platform !== 'nix') { //if (system.platform !== 'nix') {
ext = 'png'; ext = 'png';
//} //}
tmpoutput = path_1.join(TMPDIR, `export-${padded}.${ext}`);
rgb = rgb.map((e) => { rgb = rgb.map((e) => {
return parseInt(e); return parseInt(e);
}); });
tmpoutput = path_1.join(TMPDIR, `export-${padded}.${ext}`); //
//,scale=${w}:${h} cmd = `ffmpeg -y -i "${video}" -vf "select='gte(n\\,${frameNum})'${scale}" -vframes 1 -compression_algo raw -pix_fmt rgb24 "${tmpoutput}"`;
cmd = `ffmpeg -y -i "${video}" -vf "select='gte(n\\,${frame})'" -vframes 1 -compression_algo raw -pix_fmt rgb24 "${tmpoutput}"`;
cmd2 = `convert "${tmpoutput}" -resize ${w}x${h} -size ${w}x${h} xc:"rgb(${rgb[0]},${rgb[1]},${rgb[2]})" +swap -compose Darken -composite "${tmpoutput}"`; cmd2 = `convert "${tmpoutput}" -resize ${w}x${h} -size ${w}x${h} xc:"rgb(${rgb[0]},${rgb[1]},${rgb[2]})" +swap -compose Darken -composite "${tmpoutput}"`;
//ffmpeg -i "${video}" -ss 00:00:07.000 -vframes 1 "export-${time}.jpg" //ffmpeg -i "${video}" -ss 00:00:07.000 -vframes 1 "export-${time}.jpg"
//ffmpeg -i "${video}" -compression_algo raw -pix_fmt rgb24 "export-%05d.tiff" //ffmpeg -i "${video}" -compression_algo raw -pix_fmt rgb24 "export-%05d.tiff"

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ffmpeg/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,+BAA4B;AAC5B,uCAA0D;AAC1D,+BAA4B;AAI5B,IAAI,MAAM,GAAS,EAAE,CAAC;AACtB,IAAI,MAAe,CAAC;AAEpB,SAAS,YAAY,CAAE,CAAU;IAChC,IAAI,GAAG,GAAG,CAAC,CAAC,GAAG,EAAE,C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S,EAAE,EAAE;IAC9B,MAAM,GAAG,GAAG,CAAC;IACb,MAAM,GAAG,WAAI,CAAC,MAAM,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IAE3C,QAAQ,EAAE,CAAC;IAEX,OAAO;QACN,MAAM;QACN,KAAK;QACL,KAAK;QACL,QAAQ;KACR,CAAA;AACF,CAAC,CAAA"}

View File

@ -14,11 +14,11 @@ function padded_frame(i) {
return str; return str;
} }
async function frame(state, light) { async function frame(state, light) {
let frame = state.frame; const frameNum = state.frame;
let video = state.path; const video = state.path;
let w = state.info.width; const w = state.info.width;
let h = state.info.height; const h = state.info.height;
let padded = padded_frame(frame); const padded = padded_frame(frameNum);
let ext = 'tif'; let ext = 'tif';
let rgb = light.color; let rgb = light.color;
let tmpoutput; let tmpoutput;
@ -26,16 +26,20 @@ async function frame(state, light) {
let output; let output;
let cmd2; let cmd2;
let output2; let output2;
console.dir(state); let scale = '';
if (w && h) {
scale = `,scale=${w}:${h}`;
}
//console.dir(state)
//if (system.platform !== 'nix') { //if (system.platform !== 'nix') {
ext = 'png'; ext = 'png';
//} //}
tmpoutput = path_1.join(TMPDIR, `export-${padded}.${ext}`);
rgb = rgb.map((e) => { rgb = rgb.map((e) => {
return parseInt(e); return parseInt(e);
}); });
tmpoutput = path_1.join(TMPDIR, `export-${padded}.${ext}`); //
//,scale=${w}:${h} cmd = `ffmpeg -y -i "${video}" -vf "select='gte(n\\,${frameNum})'${scale}" -vframes 1 -compression_algo raw -pix_fmt rgb24 "${tmpoutput}"`;
cmd = `ffmpeg -y -i "${video}" -vf "select='gte(n\\,${frame})'" -vframes 1 -compression_algo raw -pix_fmt rgb24 "${tmpoutput}"`;
cmd2 = `convert "${tmpoutput}" -resize ${w}x${h} -size ${w}x${h} xc:"rgb(${rgb[0]},${rgb[1]},${rgb[2]})" +swap -compose Darken -composite "${tmpoutput}"`; cmd2 = `convert "${tmpoutput}" -resize ${w}x${h} -size ${w}x${h} xc:"rgb(${rgb[0]},${rgb[1]},${rgb[2]})" +swap -compose Darken -composite "${tmpoutput}"`;
//ffmpeg -i "${video}" -ss 00:00:07.000 -vframes 1 "export-${time}.jpg" //ffmpeg -i "${video}" -ss 00:00:07.000 -vframes 1 "export-${time}.jpg"
//ffmpeg -i "${video}" -compression_algo raw -pix_fmt rgb24 "export-%05d.tiff" //ffmpeg -i "${video}" -compression_algo raw -pix_fmt rgb24 "export-%05d.tiff"

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ffmpeg/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,+BAA4B;AAC5B,uCAA0D;AAC1D,+BAA4B;AAI5B,IAAI,MAAM,GAAS,EAAE,CAAC;AACtB,IAAI,MAAe,CAAC;AAEpB,SAAS,YAAY,CAAE,CAAU;IAChC,IAAI,GAAG,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC;IAC1B,IAAI,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;QACjC,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;KAChB;IACD,OAAO,GAAG,CAAC;AACZ,CAAC;AAED,KAAK,UAAU,KAAK,CAAE,KAAW,EAAE,KAAW;IAC7C,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;IACvB,IAAI,KAAK,GAAG,KAAK,CAAC,IAAI,CAAA;IACtB,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAA;IACxB,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAA;IACzB,IAAI,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;IAChC,IAAI,GAAG,GAAG,KAAK,CAAA;IACf,IAAI,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC;IACtB,IAAI,SAAS,CAAC;IACd,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BAAM,CAAC,MAAM,CAAC,CAAC;KAClC;IAAC,OAAO,GAAG,EAAE;QACb,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;KACjD;IAED,IAAI,CAAC,UAAU,EAAE;QAChB,IAAI;YACH,MAAM,gBAAK,CAAC,MAAM,CAAC,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,kBAAkB,MAAM,EAAE,CAAC,CAAC;SACxC;QAAC,OAAO,GAAG,EAAE;YACb,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;SAC7C;KACD;IACD,IAAI;QACH,MAAM,QAAQ,EAAE,CAAC;KACjB;IAAC,OAAO,GAAG,EAAE;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KACnB;AACF,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,GAAS,EAAE,EAAE;IAC9B,MAAM,GAAG,GAAG,CAAC;IACb,MAAM,GAAG,WAAI,CAAC,MAAM,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IAE3C,QAAQ,EAAE,CAAC;IAEX,OAAO;QACN,MAAM;QACN,KAAK;QACL,KAAK;QACL,QAAQ;KACR,CAAA;AACF,CAAC,CAAA"}

3
package-lock.json generated
View File

@ -681,6 +681,9 @@
} }
} }
}, },
"filmout": {
"version": "file:lib/filmout"
},
"find-replace": { "find-replace": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz", "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz",

View File

@ -20,32 +20,37 @@ function padded_frame (i : number) {
} }
async function frame (state : any, light : any) { async function frame (state : any, light : any) {
let frame = state.frame const frameNum : number = state.frame
let video = state.path const video : string = state.path
let w = state.info.width const w : number = state.info.width
let h = state.info.height const h : number = state.info.height
let padded = padded_frame(frame) const padded : string = padded_frame(frameNum)
let ext = 'tif' let ext : string = 'tif'
let rgb = light.color; let rgb : any[] = light.color;
let tmpoutput; let tmpoutput : string;
let cmd; let cmd : string;
let output; let output : any;
let cmd2; let cmd2 : string;
let output2; let output2 : any;
console.dir(state) let scale : string = '';
if (w && h) {
scale = `,scale=${w}:${h}`;
}
//console.dir(state)
//if (system.platform !== 'nix') { //if (system.platform !== 'nix') {
ext = 'png'; ext = 'png';
//} //}
tmpoutput = join(TMPDIR, `export-${padded}.${ext}`);
rgb = rgb.map((e : string) => { rgb = rgb.map((e : string) => {
return parseInt(e); return parseInt(e);
}); });
//
tmpoutput = join(TMPDIR, `export-${padded}.${ext}`); cmd = `ffmpeg -y -i "${video}" -vf "select='gte(n\\,${frameNum})'${scale}" -vframes 1 -compression_algo raw -pix_fmt rgb24 "${tmpoutput}"`;
//,scale=${w}:${h}
cmd = `ffmpeg -y -i "${video}" -vf "select='gte(n\\,${frame})'" -vframes 1 -compression_algo raw -pix_fmt rgb24 "${tmpoutput}"`;
cmd2 = `convert "${tmpoutput}" -resize ${w}x${h} -size ${w}x${h} xc:"rgb(${rgb[0]},${rgb[1]},${rgb[2]})" +swap -compose Darken -composite "${tmpoutput}"`; cmd2 = `convert "${tmpoutput}" -resize ${w}x${h} -size ${w}x${h} xc:"rgb(${rgb[0]},${rgb[1]},${rgb[2]})" +swap -compose Darken -composite "${tmpoutput}"`;
//ffmpeg -i "${video}" -ss 00:00:07.000 -vframes 1 "export-${time}.jpg" //ffmpeg -i "${video}" -ss 00:00:07.000 -vframes 1 "export-${time}.jpg"