fftools/ffmpeg: fix the wrong bitrate and speed stats
The bitrate and speed stats are wrong if the copyts is enabled. Please test with below command: wget http://samples.mplayerhq.hu/MPEG2/foxksaz.ts ./ffmpeg -y -copyts -i ./foxksaz.ts -c:v libx264 -x264opts \ nal-hrd=cbr:force-cfr=1 -b:v 3500k -minrate 3500k -maxrate 3500k -bufsize \ 1000k -c:a mp2 -muxrate 4500k -vframes 1000 test.ts before: frame= 1000 fps=112 q=-1.0 Lsize= 9063kB time=09:10:12.41 bitrate= 2.2kbits/s speed=3.7e+03x after: frame= 1000 fps=112 q=-1.0 Lsize= 9062kB time=00:00:15.78 bitrate=4703.4kbits/s speed=1.77x Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
		
							parent
							
								
									45e3131c44
								
							
						
					
					
						commit
						3da35b7cc7
					
				@ -344,6 +344,7 @@ static volatile int received_nb_signals = 0;
 | 
				
			|||||||
static atomic_int transcode_init_done = ATOMIC_VAR_INIT(0);
 | 
					static atomic_int transcode_init_done = ATOMIC_VAR_INIT(0);
 | 
				
			||||||
static volatile int ffmpeg_exited = 0;
 | 
					static volatile int ffmpeg_exited = 0;
 | 
				
			||||||
static int main_return_code = 0;
 | 
					static int main_return_code = 0;
 | 
				
			||||||
 | 
					static int64_t copy_ts_first_pts = AV_NOPTS_VALUE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
sigterm_handler(int sig)
 | 
					sigterm_handler(int sig)
 | 
				
			||||||
@ -1781,9 +1782,17 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
 | 
				
			|||||||
            vid = 1;
 | 
					            vid = 1;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        /* compute min output value */
 | 
					        /* compute min output value */
 | 
				
			||||||
        if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE)
 | 
					        if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE) {
 | 
				
			||||||
            pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st),
 | 
					            pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st),
 | 
				
			||||||
                                          ost->st->time_base, AV_TIME_BASE_Q));
 | 
					                                          ost->st->time_base, AV_TIME_BASE_Q));
 | 
				
			||||||
 | 
					            if (copy_ts) {
 | 
				
			||||||
 | 
					                if (copy_ts_first_pts == AV_NOPTS_VALUE && pts > 1)
 | 
				
			||||||
 | 
					                    copy_ts_first_pts = pts;
 | 
				
			||||||
 | 
					                if (copy_ts_first_pts != AV_NOPTS_VALUE)
 | 
				
			||||||
 | 
					                    pts -= copy_ts_first_pts;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (is_last_report)
 | 
					        if (is_last_report)
 | 
				
			||||||
            nb_frames_drop += ost->last_dropped;
 | 
					            nb_frames_drop += ost->last_dropped;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user