1
+ use crate :: ffmpeg:: create_preview_image;
1
2
use clap:: { App , Arg } ;
2
3
use std:: process;
3
4
4
5
enum Flags {
5
6
_Gif,
6
7
HLS ,
7
8
_Metadata,
8
- _PreviewImage ,
9
+ PreviewImage ,
9
10
Thumbnails ,
10
11
}
11
12
@@ -33,7 +34,7 @@ impl Flags {
33
34
Flags :: _Gif => "gif" ,
34
35
Flags :: HLS => "HLS" ,
35
36
Flags :: _Metadata => "metadata" ,
36
- Flags :: _PreviewImage => "preview_image" ,
37
+ Flags :: PreviewImage => "preview_image" ,
37
38
Flags :: Thumbnails => "thumbs" ,
38
39
}
39
40
}
@@ -68,6 +69,13 @@ fn main() {
68
69
. help ( "Generate thumbnails" )
69
70
. takes_value ( false ) ,
70
71
)
72
+ . arg (
73
+ Arg :: with_name ( Flags :: PreviewImage . as_str ( ) )
74
+ . short ( 'p' )
75
+ . long ( Flags :: PreviewImage . as_str ( ) )
76
+ . help ( "Generate preview" )
77
+ . takes_value ( false ) ,
78
+ )
71
79
. arg (
72
80
Arg :: with_name ( Flags :: HLS . as_str ( ) )
73
81
. short ( 'h' )
@@ -94,6 +102,11 @@ fn main() {
94
102
create_thumbnails ( out. file_name . clone ( ) , path. clone ( ) ) ;
95
103
}
96
104
105
+ let gen_preview_image = matches. is_present ( Flags :: PreviewImage . as_str ( ) ) ;
106
+ if gen_preview_image {
107
+ create_preview_image ( out. file_name . clone ( ) , path. clone ( ) ) ;
108
+ }
109
+
97
110
let gen_hls = matches. is_present ( Flags :: HLS . as_str ( ) ) ;
98
111
if gen_hls {
99
112
create_hls_encoding ( out. file_name . clone ( ) , path. clone ( ) ) ;
@@ -110,7 +123,7 @@ fn main() {
110
123
[ ] FFMPEG to generate media
111
124
[x] thumbnails
112
125
[ ] gif
113
- [ ] preview image
126
+ [x ] preview image
114
127
[x] HLS
115
128
[x] DASH
116
129
[ ] Metadata
0 commit comments