File tree Expand file tree Collapse file tree 3 files changed +19
-18
lines changed Expand file tree Collapse file tree 3 files changed +19
-18
lines changed Original file line number Diff line number Diff line change @@ -60,10 +60,6 @@ export default class Video extends GithubIssueOnErrorCommand {
60
60
61
61
const video = new VideoKlass ( { device, verbose : flags . debug } )
62
62
video . record ( )
63
- cli . action . start (
64
- ' 🎬 Recording started. Press SPACE to save or ESC to abort.'
65
- )
66
-
67
63
const success = await waitForKeys ( 'space' , 'escape' )
68
64
69
65
cli . action . start ( ' 📼 Processing your tape' )
Original file line number Diff line number Diff line change
1
+ import cli from 'cli-ux'
1
2
const readline = require ( 'readline' )
2
3
3
4
// TODO these should be arrays..maybeh?
@@ -12,7 +13,18 @@ export const waitForKeys = (
12
13
} )
13
14
14
15
readline . emitKeypressEvents ( rl . input )
15
- rl . input . setRawMode ( true )
16
+
17
+ if ( process . stdin . isTTY ) {
18
+ rl . input . setRawMode ( true )
19
+ cli . action . start (
20
+ ' 🎬 Recording started. Press SPACE to save or ESC to abort.'
21
+ )
22
+ } else {
23
+ cli . action . start (
24
+ ' 🎬 Recording started. Press Ctrl + C to save.'
25
+ )
26
+ process . on ( 'SIGINT' , function ( ) { resolve ( true ) } )
27
+ }
16
28
17
29
process . stdin . on ( 'keypress' , ( str , key ) => {
18
30
// console.log({ str, key })
Original file line number Diff line number Diff line change @@ -88,20 +88,13 @@ export const makeGif = async (
88
88
if ( frameOptions ) {
89
89
const intermediary = `${ os . tmpdir ( ) } /intermediary.mov`
90
90
const { extraInputs, complexFilter } = decodeFrameOptions ( frameOptions )
91
- await exec (
92
- `
93
- ${ getFfmpegBin ( ) } -i "${ inputVideoFile } " ${ extraInputs } -vcodec prores_ks -pix_fmt yuva444p10le -profile:v 4444 -q:v 23 -preset fastest ${ complexFilter } -y ${ intermediary } &&
94
- ${ getFfmpegBin ( ) } -i "${ intermediary } " -vf "${ gifFilters } ,palettegen=stats_mode=diff:max_colors=${ maxColors } " -y ${ palette } &&
95
- ${ getFfmpegBin ( ) } -i "${ intermediary } " -i "${ palette } " -lavfi "${ gifFilters } ,paletteuse=dither=${ dither } " -y "${ outputFile } .gif"
96
- `
97
- )
91
+ await exec ( `${ getFfmpegBin ( ) } -i "${ inputVideoFile } " ${ extraInputs } -vcodec prores_ks -pix_fmt yuva444p10le -profile:v 4444 -q:v 23 -preset fastest ${ complexFilter } -y ${ intermediary } ` )
92
+ await exec ( `${ getFfmpegBin ( ) } -i "${ intermediary } " -vf "${ gifFilters } ,palettegen=stats_mode=diff:max_colors=${ maxColors } " -y ${ palette } ` )
93
+ await exec ( `${ getFfmpegBin ( ) } -i "${ intermediary } " -i "${ palette } " -lavfi "${ gifFilters } ,paletteuse=dither=${ dither } " -y "${ outputFile } .gif"` )
94
+
98
95
} else {
99
- await exec (
100
- `
101
- ${ getFfmpegBin ( ) } -i "${ inputVideoFile } " -vf "${ gifFilters } ,palettegen=stats_mode=diff:max_colors=${ maxColors } " -y ${ palette } &&
102
- ${ getFfmpegBin ( ) } -i "${ inputVideoFile } " -i "${ palette } " -lavfi "${ gifFilters } ,paletteuse=dither=${ dither } " -y "${ outputFile } .gif"
103
- `
104
- )
96
+ await exec ( `${ getFfmpegBin ( ) } -i "${ inputVideoFile } " -vf "${ gifFilters } ,palettegen=stats_mode=diff:max_colors=${ maxColors } " -y ${ palette } ` )
97
+ await exec ( `${ getFfmpegBin ( ) } -i "${ inputVideoFile } " -i "${ palette } " -lavfi "${ gifFilters } ,paletteuse=dither=${ dither } " -y "${ outputFile } .gif"` )
105
98
}
106
99
107
100
return `${ outputFile } .gif`
You can’t perform that action at this time.
0 commit comments