显示毫秒的视频播放器

显示毫秒的视频播放器

我需要在我的 win7 上播放 MP4 文件,除了分和秒之外,还应该显示毫秒。

我目前有 GOM、VLC 和 MPC-HC。(请注意,我想使用常规的轻量级视频播放器,而不必在 Sony Vegas 等视频编辑程序中加载文件)。

我能得到最接近的方法是使用 MPC-HC,为视频添加一个虚拟 srt(subs)文件并启用 Subresync 选项(如下图所示https://trac.mpc-hc.org/ticket/3700)。这显示了所需的 格式mm:ss.SSS。但是创建一个虚拟 srt(应至少包含 1 个字幕条目,以便启用 Subresync 选项)很麻烦。

还有其他解决方案吗?

答案1

您几乎已经成功了。Media Player Classic (MPC-HC) 已内置此选项。右键单击右下角的时间戳,然后选择高精准度

在此处输入图片描述

其他播放器,如 VLC、SMPlayer、Mplayer、KMPlayer,没有此选项。尽管 KMPlayer 有近千个配置选项

但字幕解决方法适用于任何播放器。这里演示了 VLC

答案2

以下是用于生成字幕解决方法的字幕文件的代码(使用 Python):

def generateSRTFile(fileName, duration):
    """ 
    Generate SRT (subtitle) file for micro second display in video 

    fileName: "Movie1.srt"
    duration: "00:12:54"

    NOTE: ignored seconds to make the program more simplified
    """
    # get the hours, min, sec from duration
    time_split = duration.split(':')
    hours = int(time_split[0])
    minutes = int(time_split[1])
    seconds = 59 # int(time_split[2])
    millisecs = [x*10 for x in range(0,100)]

    # open a file to write
    f = open(name=fileName, mode='w', buffering=1)

    # iterate to print to file
    blockNo = 1
    for h in range(hours+1):
        for m in range(minutes+1):
            for s in range(seconds+1):
                for ms in millisecs:
                    f.write(subtitle(h, m, s, ms, blockNo))
                    blockNo += 1
    # close the file
    return f.close()

def subtitle(h, m, s, ms, bn):
    """
    Returns the subtitle block for the given parametes
    h: hours, m: minutes, s: seconds, ms: milli seconds, bn: block number
    """
    block = ""
    block += formatToString(bn) + "\n"
    time_line = formatToString(h)+":"+formatToString(m)+":"+formatToString(s)+","
    block += time_line+formatToString(ms, 3) + " --> " + time_line + \
        formatToString(ms+10 if ms!=990 else 999, 3) + "\n"
    block += "time " + time_line + formatToString(ms ,3) + "\n\n"
    return block

def formatToString(num, length=2):
    """
    Format given number to given length. 
    i.e num = 5 and length = 2. Result = "05" 
    """
    # number of digits in num
    digits = len(str(num))

    # mathematical equivalent for finding digits
    #n = num
    #digits = 0
    #if n==0:
        #digits = 1
    #else:
        #while n:
            #n = n/10
            #digits += 1

    # find how much shorter is num than length
    if digits >= length:
        strNum = str(num)
    else:
        diff = length-digits
        strNum = ""
        for i in range(diff):
            strNum += "0"
        strNum += str(num)
    # return
    return strNum

if __name__=="__main__":
    generateSRTFile(fileName='/home/inblueswithu/Downloads/default.srt', duration="00:05:56")

答案3

通过 VLC 获取视频文件某个时间点的毫秒时间的一种耗时方法是在所讨论的时间点或前后制作一个假的字幕文件,然后改变延迟(50 毫秒)以使帧时间精确到 50 毫秒。

示例 srt 文件可能如下所示:

1
00:00:30,000 --> 02:00:54,567
sup doc?

(查找视频中 30 秒左右最接近 50 毫秒的点)

我有一个旧的 VSDC 视频编辑器 (33MB),它也有一个内置搜索器,以毫秒为单位显示帧数和搜索时间:

1-Total video time & number of frames 
2-Timeline can be toggled to display video in milliseconds or frames
3-seeker
4-toggle switch
5-current position (in milliseconds)

威斯特直流

相关内容