Opened 10 years ago
Closed 10 years ago
#4041 closed defect (invalid)
Bad input frame rate estimation
Reported by: | qianliang | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
How to reproduce:
% ffmpeg -i input.ts -c copy output.mp4 Input #0, mpegts, from 'input.ts': Duration: 00:00:59.43, start: 62.100000, bitrate: 1623 kb/s Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 640x480, 20 fps, 40 tbr, 90k tbn, 40 tbc Output #0, mp4, to 'output.mp4': Metadata: encoder : Lavf56.9.100 Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x480, q=2-31, 20 fps, 90k tbn, 90k tbc Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help frame= 1488 fps=0.0 q=-1.0 Lsize= 10781kB time=00:00:59.40 bitrate=1486.9kbits/s video:10767kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.128117% ffmpeg version ffmpeg version N-66797-gb8a5599 built on http://ffmpeg.zeranoe.com/builds/
It shows output.mp4 with 20 fps. But
% ffmpeg -i output.mp4 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf56.9.100 Duration: 00:00:59.45, start: 0.000000, bitrate: 1485 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480, 1483 kb/s, 25.03 fps, 40 tbr, 90k tbn, 4 0 tbc (default) Metadata: handler_name : VideoHandler
The fps changed to 25.03 fps
Change History (6)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Keywords: | fps metadata removed |
---|---|
Priority: | important → normal |
Summary: | ffmpeg copy ts to mp4, fps was changed → Bad input frame rate estimation |
How did you create the input file?
follow-up: 5 comment:3 by , 10 years ago
First I do segment operation:
ffmpeg -i source.ts -map 0:v -f segment -segment_time 60 source_video_%d.ts
And do convert oeration:
ffmpeg -i source_video_0.ts -vcodec libx264 -vb 1200k -maxrate 1800k -bufsize 3600k -r 20 -vprofile main -pix_fmt yuv420p -flags +loop+mv4 -cmp 256 -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 7 -coder 1 -trellis 1 -refs 4 -me_range 16 -sc_threshold 40 -i_qfactor 0.71 -qcomp 0.6 -qmin 15 -qmax 45 -qdiff 4 -rc_eq 'blurCplx^(1-qComp)' -tune zerolatency -x264opts keyint=120:min-keyint=25:b-pyramid=0:weightp=0:interlaced=0:mixed-refs=1:8x8dct=1 -vsync 0 -copyts input.ts
Here comes out the input.ts
comment:4 by , 10 years ago
I find that adding filter "fps=20" while do convert operation, which would fix this problem:
ffmpeg -i source_video_0.ts -filter_complex "fps=20" -vcodec libx264 -vb 1200k -maxrate 1800k -bufsize 3600k -r 20 -vprofile main -pix_fmt yuv420p -flags +loop+mv4 -cmp 256 -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 7 -coder 1 -trellis 1 -refs 4 -me_range 16 -sc_threshold 40 -i_qfactor 0.71 -qcomp 0.6 -qmin 15 -qmax 45 -qdiff 4 -rc_eq 'blurCplx^(1-qComp)' -tune zerolatency -x264opts keyint=120:min-keyint=25:b-pyramid=0:weightp=0:interlaced=0:mixed-refs=1:8x8dct=1 -vsync 0 -copyts input.ts
comment:5 by , 10 years ago
Replying to qianliang:
ffmpeg -i source_video_0.ts -vcodec libx264 -vb 1200k -maxrate 1800k -bufsize 3600k -r 20 -vprofile main -pix_fmt yuv420p -flags +loop+mv4 -cmp 256 -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 7 -coder 1 -trellis 1 -refs 4 -me_range 16 -sc_threshold 40 -i_qfactor 0.71 -qcomp 0.6 -qmin 15 -qmax 45 -qdiff 4 -rc_eq 'blurCplx^(1-qComp)' -tune zerolatency -x264opts keyint=120:min-keyint=25:b-pyramid=0:weightp=0:interlaced=0:mixed-refs=1:8x8dct=1 -vsync 0 -copyts input.ts
Using -r 20
and -vsync 0
together leads to invalid files, in your case a file with 25fps (25 actual frames per second) that looks like a 20fps file.
You are requesting put 20 files per second in the output stream and keep 25 frames per second, don't drop or duplicate any frames. It is impossible for ffmpeg
to fulfill both requests, I just sent a patch that prints a message if both options were specified.
comment:6 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
A patch was pushed that prints an error message if -vsync 0
and -r
are used together.
But copy to mkv and flv, it came out the same fps value(20) as ts.
Here is my source video:
https://www.dropbox.com/s/8hi6zwggo129xt4/input.ts?dl=0