@@ -106,7 +106,7 @@ fn main() -> Result<()> {
106106 }
107107
108108 let mut ffmpeg_wtr =
109- ffmpeg_writer :: FfmpegWriter :: new ( cli. output . as_str ( ) , Default :: default ( ) , None ) ?;
109+ ffmpeg_rewriter :: FfmpegReWriter :: new ( cli. output . as_str ( ) , Default :: default ( ) , None , None ) ?;
110110
111111 let mut pb: Option < ProgressBar > = if !cli. no_progress {
112112 let ( lower_bound, _upper_bound) = src. iter ( ) . size_hint ( ) ;
@@ -133,24 +133,25 @@ fn main() -> Result<()> {
133133 eyre:: bail!( "Frame {idx} has no decoded image data." , ) ;
134134 } ;
135135
136- let text = match frame. timestamp ( ) {
137- frame_source:: Timestamp :: Duration ( dur) => {
138- format ! (
139- "{}" ,
140- ( t0 + dur) . to_rfc3339_opts( chrono:: format:: SecondsFormat :: Millis , true )
141- )
142- }
143- frame_source:: Timestamp :: Fraction ( frac) => {
144- format ! ( "{:2.1}%" , frac * 100.0 )
136+ let dur = match frame. timestamp ( ) {
137+ frame_source:: Timestamp :: Duration ( dur) => dur,
138+ _ => {
139+ eyre:: bail!( "Expected duration timestamp" ) ;
145140 }
146141 } ;
142+ let ts = t0 + dur;
143+
144+ let text = format ! (
145+ "{}" ,
146+ ts. to_rfc3339_opts( chrono:: format:: SecondsFormat :: Millis , true )
147+ ) ;
147148
148149 let mut frame_rgb8 = im. into_pixel_format ( ) ?. owned ( ) ;
149150 stamp_frame ( & mut frame_rgb8, & font, & text) ?;
150151
151152 let dy_im = strand_dynamic_frame:: DynamicFrame :: from_static_ref ( & frame_rgb8) ;
152153
153- ffmpeg_wtr. write_dynamic_frame ( & dy_im) ?;
154+ ffmpeg_wtr. write_dynamic_frame ( & dy_im, ts ) ?;
154155 }
155156
156157 ffmpeg_wtr. close ( ) ?;
0 commit comments