Scale frame export to video's advertized size
This commit is contained in:
parent
b6a6b8a81e
commit
3493759998
|
@ -20,20 +20,24 @@ function padded_frame (i) {
|
|||
return str;
|
||||
}
|
||||
|
||||
async function frame (video, frame, obj) {
|
||||
let padded = padded_frame(frame);
|
||||
let ext = 'tif';
|
||||
let tmpoutput;
|
||||
let cmd;
|
||||
let output;
|
||||
async function frame (state) {
|
||||
let frame = state.frame
|
||||
let video = state.path
|
||||
let w = state.info.width
|
||||
let h = state.info.height
|
||||
let padded = padded_frame(frame)
|
||||
let ext = 'tif'
|
||||
let tmpoutput
|
||||
let cmd
|
||||
let output
|
||||
|
||||
if (system.platform !== 'nix') {
|
||||
ext = 'png';
|
||||
ext = 'png'
|
||||
}
|
||||
|
||||
tmpoutput = path.join(TMPDIR, `export-${padded}.${ext}`)
|
||||
|
||||
cmd = `ffmpeg -i "${video}" -vf select='gte(n\\,${frame})' -vframes 1 -compression_algo raw -pix_fmt rgb24 "${tmpoutput}"`
|
||||
cmd = `ffmpeg -i "${video}" -vf "select='gte(n\\,${frame})',scale=${w}:${h}" -vframes 1 -compression_algo raw -pix_fmt rgb24 "${tmpoutput}"`
|
||||
|
||||
//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"
|
||||
|
|
16
app/main.js
16
app/main.js
|
@ -554,23 +554,23 @@ dig.move = async function () {
|
|||
|
||||
if (last > 0) {
|
||||
display.end()
|
||||
//wipe last frame
|
||||
try {
|
||||
await ffmpeg.clear(last)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await ffmpeg.frame(dig.state.path, dig.state.frame)
|
||||
await ffmpeg.clearAll()
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
|
||||
try {
|
||||
await ffmpeg.frame(dig.state)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
|
||||
display.start(dig.state.frame)
|
||||
|
||||
await delay(100)
|
||||
await delay(600)
|
||||
|
||||
return (+new Date()) - start
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue