Don't rebase/normalize the timestamps
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
Currently, decord rebase/normalize the timestamps. It should not do it without asking the user.
Here is an sample to compare the result of ffms2 vs decord:
[Sample.zip](https://github.com/dmlc/decord/files/9945976/Sample.zip)
```py
from decord import VideoReader
from ffms2 import VideoSource
from typing import List
def with_pyffms2(video: str) -> List[int]:
"""
Link: https://pypi.org/project/ffms2/
"""
video_source = VideoSource(video)
timestamps = [
int(
(frame.PTS * video_source.track.time_base.numerator)
/ video_source.track.time_base.denominator
)
for frame in video_source.track.frame_info_list
]
return timestamps
def with_decord(video: str):
vr = VideoReader(video)
timestamps = vr.get_frame_timestamp(range(len(vr)))
timestamps = (timestamps[:] * 1000).tolist()
return timestamps
def main():
video = r"Sample.mkv"
ffms2_timestamps = with_pyffms2(video)
print(f"ffms2_timestamps:\n{ffms2_timestamps}")
decord_timestamps = with_decord(video)
print(f"decord_timestamps:\n{decord_timestamps}")
if __name__ == "__main__":
main()
```
It print
```
ffms2_timestamps:
[1000, 1042, 1083, 1125, 1167, 1209, 1250, 1292, 1334, 1375, 1417, 1459, 1501, 1542, 1584, 1626, 1667, 1709, 1751, 1792, 1834, 1876, 1918, 1959, 2001, 2043, 2084, 2126, 2168, 2210, 2251, 2293, 2335, 2376, 2418, 2460, 2502, 2543, 2585, 2627, 2668, 2710, 2752, 2793, 2835, 2877, 2919, 2960, 3002, 3044, 3085, 3127, 3169, 3211, 3252, 3294, 3336, 3377, 3419, 3461, 3503, 3544, 3586, 3628, 3669, 3711, 3753, 3794, 3836, 3878, 3920, 3961, 4003, 4045, 4086, 4128, 4170, 4212, 4253, 4295, 4337, 4378, 4420, 4462, 4504, 4545, 4587, 4629, 4670, 4712, 4754, 4795, 4837, 4879, 4921, 4962, 5004, 5046, 5087, 5129, 5171, 5213, 5254, 5296, 5338, 5379, 5421, 5463, 5505, 5546, 5588, 5630, 5671, 5713, 5755, 5796, 5838, 5880, 5922, 5963, 6005, 6047, 6088, 6130, 6172, 6214, 6255, 6297, 6339, 6380, 6422, 6464, 6506, 6547, 6589, 6631, 6672, 6714, 6756, 6797, 6839, 6881, 6923, 6964, 7006, 7048, 7089, 7131, 7173, 7215, 7256, 7298, 7340, 7381, 7423, 7465, 7507, 7548, 7590, 7632, 7673, 7715, 7757, 7798, 7840, 7882, 7924, 7965, 8007, 8049, 8090, 8132, 8174, 8216, 8257, 8299, 8341, 8382, 8424, 8466, 8508, 8549, 8591, 8633, 8674, 8716, 8758, 8799, 8841, 8883, 8925, 8966, 9008, 9050, 9091, 9133, 9175, 9217, 9258, 9300, 9342, 9383, 9425, 9467, 9509, 9550, 9592, 9634, 9675, 9717, 9759, 9800, 9842, 9884, 9926, 9967, 10009, 10051, 10092, 10134, 10176, 10218, 10259, 10301, 10343, 10384, 10426, 10468, 10510, 10551, 10593, 10635, 10676, 10718, 10760, 10801, 10843, 10885, 10927, 10968, 11010, 11052, 11093, 11135, 11177, 11219, 11260, 11302, 11344, 11385, 11427, 11469, 11511, 11552, 11594, 11636, 11677, 11719, 11761, 11802, 11844, 11886, 11928, 11969, 12011, 12053, 12094, 12136, 12178, 12220, 12261, 12303, 12345, 12386, 12428, 12470, 12512, 12553, 12595, 12637, 12678, 12720, 12762, 12803, 12845, 12887, 12929, 12970, 13012, 13054, 13095, 13137, 13179, 13221, 13262, 13304, 13346, 13387, 13429, 13471, 13513, 13554, 13596, 13638, 13679, 13721, 13763, 13804, 13846, 13888, 13930, 13971, 14013, 14055, 14096, 14138, 14180, 14222, 14263, 14305, 14347, 14388, 14430, 14472, 14514, 14555, 14597, 14639, 14680, 14722, 14764, 14805, 14847, 14889, 14931, 14972, 15014, 15056, 15097, 15139, 15181, 15223, 15264, 15306, 15348, 15389, 15431, 15473, 15515, 15556, 15598, 15640, 15681, 15723, 15765, 15806, 15848, 15890, 15932, 15973, 16015, 16057, 16098, 16140, 16182, 16224, 16265, 16307, 16349, 16390, 16432, 16474, 16516, 16557, 16599, 16641, 16682, 16724, 16766, 16807, 16849, 16891, 16933, 16974, 17016, 17058, 17099]
decord_timestamps:
[[0.0, 41.0], [42.0, 83.0], [83.0, 124.0], [125.0, 166.0], [167.0, 208.0], [209.0, 250.0], [250.0, 291.0], [292.0, 333.0], [334.0, 375.0], [375.0, 416.0], [417.0, 458.0], [459.0, 500.0], [501.0, 542.0], [542.0, 583.0], [584.0, 625.0], [626.0, 667.0], [667.0, 708.0], [709.0, 750.0], [751.0, 792.0], [792.0, 833.0], [834.0, 875.0], [876.0, 917.0], [918.0, 959.0], [959.0, 1000.0], [1001.0000610351562, 1042.0], [1043.0, 1084.0], [1084.0, 1125.0], [1126.0, 1167.0], [1168.0, 1209.0], [1210.0, 1251.0], [1251.0, 1292.0], [1293.0, 1334.0], [1335.0, 1376.0], [1376.0, 1417.0], [1418.0, 1459.0], [1460.0, 1501.0], [1502.0, 1543.0], [1543.0, 1584.0], [1585.0, 1626.0], [1627.0, 1668.0], [1668.0, 1709.0], [1710.0, 1751.0], [1752.0, 1793.0], [1793.0, 1834.0], [1835.0, 1876.0], [1877.0, 1918.0], [1919.0, 1960.0], [1960.0, 2000.9998779296875], [2002.0001220703125, 2043.0], [2043.9998779296875, 2085.0], [2085.0, 2126.0], [2127.0, 2168.0], [2169.0, 2210.0], [2211.0, 2252.0], [2252.0, 2293.0], [2294.0, 2335.0], [2336.0, 2377.0], [2377.0, 2418.0], [2419.0, 2460.0], [2461.0, 2502.0], [2503.0, 2544.0], [2544.0, 2585.0], [2586.0, 2627.0], [2628.0, 2669.0], [2669.0, 2710.0], [2711.0, 2752.0], [2753.0, 2794.0], [2794.0, 2835.0], [2836.0, 2877.0], [2878.0, 2919.0], [2920.0, 2961.0], [2961.0, 3002.0], [3003.0, 3044.0], [3045.0, 3086.0], [3086.0, 3127.0], [3128.0, 3169.0], [3170.0, 3211.0], [3212.0, 3253.0], [3253.0, 3294.0], [3295.0, 3336.0], [3337.0, 3378.0], [3378.0, 3419.0], [3420.0, 3461.0], [3462.0, 3503.0], [3504.0, 3545.0], [3545.0, 3586.0], [3587.0, 3628.0], [3629.0, 3670.0], [3670.0, 3711.0], [3712.0, 3753.0], [3754.0, 3795.0], [3795.0, 3836.0], [3837.0, 3878.0], [3879.0, 3920.0], [3921.0, 3962.0], [3962.0, 4002.999755859375], [4004.000244140625, 4045.0], [4046.0, 4087.0], [4087.0, 4128.0], [4129.0, 4170.0], [4171.0, 4212.0], [4213.0, 4254.0], [4254.0, 4295.0], [4296.0, 4337.0], [4338.0, 4379.0], [4379.0, 4420.0], [4421.0, 4462.0], [4463.0, 4504.0], [4505.0, 4546.0], [4546.0, 4587.0], [4588.0, 4629.0], [4630.0, 4671.0], [4671.0, 4712.0], [4713.0, 4754.0], [4755.0, 4796.0], [4796.0, 4837.0], [4838.0, 4879.0], [4880.0, 4921.0], [4922.0, 4963.0], [4963.0, 5004.0], [5005.0, 5046.0], [5047.0, 5088.0], [5088.0, 5129.0], [5130.0, 5171.0], [5172.0, 5213.0], [5214.0, 5255.0], [5255.0, 5296.0], [5297.0, 5338.0], [5339.0, 5380.0], [5380.0, 5421.0], [5422.0, 5463.0], [5464.0, 5505.0], [5506.0, 5547.0], [5547.0, 5588.0], [5589.0, 5630.0], [5631.0, 5672.0], [5672.0, 5713.0], [5714.0, 5755.0], [5756.0, 5797.0], [5797.0, 5838.0], [5839.0, 5880.0], [5881.0, 5922.0], [5923.0, 5964.0], [5964.0, 6005.0], [6006.0, 6047.0], [6048.0, 6089.0], [6089.0, 6130.0], [6131.0, 6172.0], [6173.0, 6214.0], [6215.0, 6256.0], [6256.0, 6297.0], [6298.0, 6339.0], [6340.0, 6381.0], [6381.0, 6422.0], [6423.0, 6464.0], [6465.0, 6506.0], [6507.0, 6548.0], [6548.0, 6589.0], [6590.0, 6631.0], [6632.0, 6673.0], [6673.0, 6714.0], [6715.0, 6756.0], [6757.0, 6798.0], [6798.0, 6839.0], [6840.0, 6881.0], [6882.0, 6923.0], [6924.0, 6965.0], [6965.0, 7006.0], [7007.0, 7048.0], [7049.0, 7090.0], [7090.0, 7131.0], [7132.0, 7173.0], [7174.0, 7215.0], [7216.0, 7257.0], [7257.0, 7298.0], [7299.0, 7340.0], [7341.0, 7382.0], [7382.0, 7423.0], [7424.0, 7465.0], [7466.0, 7507.0], [7508.0, 7549.0], [7549.0, 7590.0], [7591.0, 7632.0], [7633.0, 7674.0], [7674.0, 7715.0], [7716.0, 7757.0], [7758.0, 7799.0], [7799.0, 7840.0], [7841.0, 7882.0], [7883.0, 7924.0], [7925.0, 7966.0], [7966.0, 8007.0], [8008.00048828125, 8049.0], [8050.0, 8090.99951171875], [8090.99951171875, 8132.0], [8133.00048828125, 8174.0], [8175.0, 8216.0], [8217.0, 8258.0], [8258.0, 8299.0], [8300.0, 8341.0], [8342.0, 8383.0], [8383.0, 8424.0], [8425.0, 8466.0], [8467.0, 8508.0], [8509.0, 8550.0], [8550.0, 8591.0], [8592.0, 8633.0], [8634.0, 8675.0], [8675.0, 8716.0], [8717.0, 8758.0], [8759.0, 8800.0], [8800.0, 8841.0], [8842.0, 8883.0], [8884.0, 8925.0], [8926.0, 8967.0], [8967.0, 9008.0], [9009.0, 9050.0], [9051.0, 9092.0], [9092.0, 9133.0], [9134.0, 9175.0], [9176.0, 9217.0], [9218.0, 9259.0], [9259.0, 9300.0], [9301.0, 9342.0], [9343.0, 9384.0], [9384.0, 9425.0], [9426.0, 9467.0], [9468.0, 9509.0], [9510.0, 9551.0], [9551.0, 9592.0], [9593.0, 9634.0], [9635.0, 9676.0], [9676.0, 9717.0], [9718.0, 9759.0], [9760.0, 9801.0], [9801.0, 9842.0], [9843.0, 9884.0], [9885.0, 9926.0], [9927.0, 9968.0], [9968.0, 10009.0], [10010.0, 10051.0], [10052.0, 10093.0], [10093.0, 10134.0], [10135.0, 10176.0], [10177.0, 10218.0], [10219.0, 10260.0], [10260.0, 10301.0], [10302.0, 10343.0], [10344.0, 10385.0], [10385.0, 10426.0], [10427.0, 10468.0], [10469.0, 10510.0], [10511.0, 10552.0], [10552.0, 10593.0], [10594.0, 10635.0], [10636.0, 10677.0], [10677.0, 10718.0], [10719.0, 10760.0], [10761.0, 10802.0], [10802.0, 10843.0], [10844.0, 10885.0], [10886.0, 10927.0], [10928.0, 10969.0], [10969.0, 11010.0], [11011.0, 11052.0], [11053.0, 11094.0], [11094.0, 11135.0], [11136.0, 11177.0], [11178.0, 11219.0], [11220.0, 11261.0], [11261.0, 11302.0], [11303.0, 11344.0], [11345.0, 11386.0], [11386.0, 11427.0], [11428.0, 11469.0], [11470.0, 11511.0], [11512.0, 11553.0], [11553.0, 11594.0], [11595.0, 11636.0], [11637.0, 11678.0], [11678.0, 11719.0], [11720.0, 11761.0], [11762.0, 11803.0], [11803.0, 11844.0], [11845.0, 11886.0], [11887.0, 11928.0], [11929.0, 11970.0], [11970.0, 12011.0], [12012.0, 12053.0], [12054.0, 12095.0], [12095.0, 12136.0], [12137.0, 12178.0], [12179.0, 12220.0], [12221.0, 12262.0], [12262.0, 12303.0], [12304.0, 12345.0], [12346.0, 12387.0], [12387.0, 12428.0], [12429.0, 12470.0], [12471.0, 12512.0], [12513.0, 12554.0], [12554.0, 12595.0], [12596.0, 12637.0], [12638.0, 12679.0], [12679.0, 12720.0], [12721.0, 12762.0], [12763.0, 12804.0], [12804.0, 12845.0], [12846.0, 12887.0], [12888.0, 12929.0], [12930.0, 12971.0], [12971.0, 13012.0], [13013.0, 13054.0], [13055.0, 13096.0], [13096.0, 13137.0], [13138.0, 13179.0], [13180.0, 13221.0], [13222.0, 13263.0], [13263.0, 13304.0], [13305.0, 13346.0], [13347.0, 13388.0], [13388.0, 13429.0], [13430.0, 13471.0], [13472.0, 13513.0], [13514.0, 13555.0], [13555.0, 13596.0], [13597.0, 13638.0], [13639.0, 13680.0], [13680.0, 13721.0], [13722.0, 13763.0], [13764.0, 13805.0], [13805.0, 13846.0], [13847.0, 13888.0], [13889.0, 13930.0], [13931.0, 13972.0], [13972.0, 14013.0], [14014.0, 14055.0], [14056.0, 14097.0], [14097.0, 14138.0], [14139.0, 14180.0], [14181.0, 14222.0], [14223.0, 14264.0], [14264.0, 14305.0], [14306.0, 14347.0], [14348.0, 14389.0], [14389.0, 14430.0], [14431.0, 14472.0], [14473.0, 14514.0], [14515.0, 14556.0], [14556.0, 14597.0], [14598.0, 14639.0], [14640.0, 14681.0], [14681.0, 14722.0], [14723.0, 14764.0], [14765.0, 14806.0], [14806.0, 14847.0], [14848.0, 14889.0], [14890.0, 14931.0], [14932.0, 14973.0], [14973.0, 15014.0], [15015.0, 15056.0], [15057.0, 15098.0], [15098.0, 15139.0], [15140.0, 15181.0], [15182.0, 15223.0], [15224.0, 15265.0], [15265.0, 15306.0], [15307.0, 15348.0], [15349.0, 15390.0], [15390.0, 15431.0], [15432.0, 15473.0], [15474.0, 15515.0], [15516.0, 15557.0], [15557.0, 15598.0], [15599.0, 15640.0], [15641.0, 15682.0], [15682.0, 15723.0], [15724.0, 15765.0], [15766.0, 15807.0], [15807.0, 15848.0], [15849.0, 15890.0], [15891.0, 15932.0], [15933.0, 15974.0], [15974.0, 16014.9990234375], [16016.0009765625, 16056.9990234375], [16058.0009765625, 16099.0009765625], [16099.0009765625, 16139.9990234375]]
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.