mp4fpsmod icon indicating copy to clipboard operation
mp4fpsmod copied to clipboard

Minimum timescale required when using DTS compression

Open tuxa opened this issue 5 years ago • 1 comments

When using DTS compression together with a small enough timescale, timecodes will overflow:

# create empty video with 0.5s duration
ffmpeg -t 0.5 -s 640x480 -f rawvideo -pix_fmt rgb24 -r 24 -i /dev/zero video.mp4

# this will produce a damaged video file that cant even be played with vlc
mp4fpsmod video.mp4 -T 30 -r 0:24 -c -o video_out.mp4

The timecodes of the video_out.mp4 will look like this:

# timecode format v2
0
33.3333333333333
100
133.333333333333
166.666666666667
143165576733.333
143165576800
143165576833.333
143165576866.667
143165576900
143165576966.667
143165577000

I created a table that shows the minimum timescale needed for a given number of fps. E.g. in the above example with 24 fps setting the timescale to 34 would work.

fps=1, ts=2
fps=2, ts=3
fps=3, ts=5
fps=4, ts=6
fps=5, ts=8
fps=6, ts=9
fps=7, ts=10
fps=8, ts=12
fps=9, ts=13
fps=10, ts=15
fps=11, ts=16
fps=12, ts=17
fps=13, ts=19
fps=14, ts=20
fps=15, ts=22
fps=16, ts=23
fps=17, ts=25
fps=18, ts=26
fps=19, ts=27
fps=20, ts=29
fps=21, ts=30
fps=22, ts=32
fps=23, ts=33
fps=24, ts=34
fps=25, ts=36
fps=26, ts=37
fps=27, ts=39
fps=28, ts=40
fps=29, ts=42
fps=30, ts=43
fps=31, ts=44
fps=32, ts=46
fps=33, ts=47
fps=34, ts=49
fps=35, ts=50
fps=36, ts=51
fps=37, ts=53
fps=38, ts=54
fps=39, ts=56
fps=40, ts=57
fps=41, ts=59
fps=42, ts=60
fps=43, ts=61
fps=44, ts=63
fps=45, ts=64
fps=46, ts=66
fps=47, ts=67
fps=48, ts=68
fps=49, ts=70
fps=50, ts=71
fps=51, ts=73
fps=52, ts=74
fps=53, ts=76
fps=54, ts=77
fps=55, ts=78
fps=56, ts=80
fps=57, ts=81
fps=58, ts=83
fps=59, ts=84

tuxa avatar Sep 16 '20 19:09 tuxa

not a bug imo, " Usage: ... -t and -r are exclusive, and cannot be set both at the same time. "

vasyl-zabolotniy avatar Dec 23 '20 02:12 vasyl-zabolotniy