最近看下载了些英文电影,想参照英文字幕来看,结果下载的英文字幕和rmvb格式电影,不能够同步,所以想解决这个问题
方法一:
    编辑rmvb格式的电影,这个方法在baidu里边搜索"编辑rmvb格式",有很多解决方法,在此就不再赘述了!
方法二:
    编辑英文字幕的时间来与电影相对应,在此我写了一个小程序来实现的,贴出来大家一起研究吧! 
  html代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EditTxt.aspx.cs" Inherits="EditTxt" ValidateRequest="false" %>
<html>
<head runat="server">
    <title>Edit Page</title>
    <script language="javascript">
        function GetPath(obj,flg)
        {
             if(flg=="1")
             {
                document.getElementById("<%=this.FileNameTextBox.ClientID %>").value=obj.value;
             }
             else if(flg=="2")
             {
                document.getElementById("<%=this.writeTextBox.ClientID %>").value=obj.value;
             }
        } 
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <table>
            <tr>
                <td width="150px">
                    Choose Txt file:
                </td>
                <td width="400px">
                    <asp:FileUpload ID="fileTxtPath" runat="server" onblur="GetPath(this,'1')" />
                    <asp:TextBox ID="FileNameTextBox" runat="server" Text="C:\kiss-fg-cd1.eng1.txt"></asp:TextBox></td>
            </tr>
            <tr>
                <td>
                    Please Input Time:</td>
                <td>
                    h:<asp:TextBox ID="txtHTime" runat="server" Width="40px" Text="0"></asp:TextBox>
                    m:<asp:TextBox ID="txtMTime" runat="server" Width="40px" Text="0"></asp:TextBox>
                    s:<asp:TextBox ID="txtSTime" runat="server" Width="40px" Text="0"></asp:TextBox></td>
            </tr>
            <tr>
                <td>
                    Write In File:
                </td>
                <td>
                    <asp:FileUpload ID="FileUpload1" runat="server" onblur="GetPath(this,'2')" />
                    <asp:TextBox ID="writeTextBox" runat="server" Text="D:\newkiss.txt"></asp:TextBox></td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btnAddTime" runat="server" Text="Add Time" OnClick="btnAddTime_Click" />
                </td>
                <td>
                    <asp:Label ID="MsgLabel" ForeColor="red" runat="server"></asp:Label>
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <td>
                    <asp:TextBox ID="FileContentTextBox" runat="server" TextMode="MultiLine" Width="300"
                        Height="500px"></asp:TextBox></td>
                <td>
                    <asp:TextBox ID="newContent" runat="server" TextMode="MultiLine" Width="300" Height="500px"></asp:TextBox></td>
            </tr>
        </table>
    </form>
</body>
</html>

C#代码部分:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text.RegularExpressions;
using System.IO;
using System.Text;
using System.Security.Permissions;
using System.Security.AccessControl;
using System.Runtime.InteropServices;

public partial class EditTxt : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    protected void btnAddTime_Click(object sender, EventArgs e)
    {
        ReadControlFile();
    }
    // Adds an ACL entry on the specified file for the specified account.
    public static void AddFileSecurity(string fileName, string account, FileSystemRights rights, AccessControlType controlType)
    {
        // Get a FileSecurity object that represents the current security settings.
        FileSecurity fSecurity = File.GetAccessControl(fileName);

        // Add the FileSystemAccessRule to the security settings. 
        fSecurity.AddAccessRule(new FileSystemAccessRule(account, rights, controlType));

        // Set the new access settings.
        File.SetAccessControl(fileName, fSecurity);
    }

    // Removes an ACL entry on the specified file for the specified account.
    public static void RemoveFileSecurity(string fileName, string account,FileSystemRights rights, AccessControlType controlType)
    {
        // Get a FileSecurity object that represents the current security settings.
        FileSecurity fSecurity = File.GetAccessControl(fileName);

        // Add the FileSystemAccessRule to the security settings. 
        fSecurity.RemoveAccessRule(new FileSystemAccessRule(account,rights, controlType));

        // Set the new access settings.
        File.SetAccessControl(fileName, fSecurity);
    }

    private void ReadControlFile()
    {
        int hError = txtHTime.Text.Length > 0 ? Convert.ToInt32(txtHTime.Text) : 0;
        int mError = txtMTime.Text.Length > 0 ? Convert.ToInt32(txtMTime.Text) : 0;
        int sError = txtSTime.Text.Length > 0 ? Convert.ToInt32(txtSTime.Text) : 0;
        FileContentTextBox.Text = "";
        newContent.Text = "";
        StreamWriter sw;
        try
        {
            //fileTxtPath.PostedFile.FileName
            if (!File.Exists(FileNameTextBox.Text))
            {
                MsgLabel.Text = "This file is no Exist!";
                return;
            }
            else
            {
                FileIOPermission fileIOPerm1;
                fileIOPerm1 = new FileIOPermission(FileIOPermissionAccess.AllAccess, writeTextBox.Text);
                fileIOPerm1.AllFiles = FileIOPermissionAccess.Write;
                fileIOPerm1.AllLocalFiles = FileIOPermissionAccess.Write;

                FileInfo aa = new FileInfo(writeTextBox.Text);
                //FileSecurity security = aa.GetAccessControl();

                // Add the access control entry to the file.
                //AddFileSecurity(writeTextBox.Text, "bitoc.net/shen_hengjun@bitoc.net", FileSystemRights.Write, AccessControlType.Allow);

                StreamReader sr = File.OpenText(FileNameTextBox.Text);
                sw = File.CreateText(writeTextBox.Text);
                String[] lines = File.ReadAllLines(FileNameTextBox.Text);
                string content = sr.ReadToEnd();
                String regex = "\\d\\d:\\d\\d:\\d\\d,\\d\\d\\d --> \\d\\d:\\d\\d:\\d\\d,\\d\\d\\d";
                int timeError = hError * 3600 + mError * 60 + sError;

                foreach (string line in lines)
                {
                    MatchCollection mm = Regex.Matches(line, regex);
                    StringBuilder newLine = new StringBuilder(500);
                    if (mm.Count > 0)
                    {
                        int times;
                        int second = Convert.ToInt32(line.Substring(6, 2));
                        int minute = Convert.ToInt32(line.Substring(3, 2));
                        int hour = Convert.ToInt32(line.Substring(0, 2));
                        times = timeError + second + minute * 60 + hour * 3600;
                        String shour = "0" + (times / 3600);
                        String sminute = "0" + ((times % 3600) / 60);
                        String ssecond = "0" + (times % 60);
                        int second2 = Convert.ToInt32(line.Substring(23, 2));
                        int minute2 = Convert.ToInt32(line.Substring(20, 2));
                        int hour2 = Convert.ToInt32(line.Substring(17, 2));
                        times = timeError + second2 + minute2 * 60 + hour2 * 3600;
                        String shour2 = "0" + (times / 3600);
                        String sminute2 = "0" + ((times % 3600) / 60);
                        String ssecond2 = "0" + (times % 60);

                        newLine.Append(shour.Substring(shour.Length - 2) + ":");
                        newLine.Append(sminute.Substring(sminute.Length - 2) + ":");
                        newLine.Append(ssecond.Substring(ssecond.Length - 2) + ",");
                        newLine.Append(line.Substring(9, 3) + " --> ");
                        newLine.Append(shour2.Substring(shour2.Length - 2) + ":");
                        newLine.Append(sminute2.Substring(sminute2.Length - 2) + ":");
                        newLine.Append(ssecond2.Substring(ssecond2.Length - 2) + ",");
                        newLine.Append(line.Substring(26, 3));
                        sw.WriteLine(newLine.ToString());
                    }
                    else
                    {
                        sw.WriteLine(line);
                    }
                }
                sw.Close();

                FileContentTextBox.Text = content;
                sr.Close();
                MsgLabel.Text = "Sucess!!";
                StreamReader newsr = File.OpenText(writeTextBox.Text);
                newContent.Text = newsr.ReadToEnd();
                newsr.Close();

                // Remove the access control entry from the file.
                //RemoveFileSecurity(writeTextBox.Text, @"DomainName\AccountName", FileSystemRights.ReadData, AccessControlType.Allow);

            }

        }
        catch (Exception ce)
        {
            MsgLabel.Text = "Fail for :" + ce.ToString();
            //sr.Close();
        }
        finally
        {
        }
    }
}

页面的效果是这个样子的:

其中AddFileSecurity和RemoveFileSecurity这两个方法是从微软msdn上抄的,是对要写的那个txt进行属性修改,但是我没调试成功!

在这儿推荐一个电影字幕下载的好网站:http://www.shooter.cn/  射手网
感谢http://hi.baidu.com/xiaoyaogg/blog/item/9c2053af202d1bfafbed5021.html

转载于:https://www.cnblogs.com/0633shj/archive/2008/06/05/1214096.html

编辑电影字幕,编辑srt格式相关推荐

  1. python 实现 PC端剪映字幕转换SRT格式工具代码-Python 实现

    #encoding:utf-8 import json import time import datetime import os import socket import getpassuser_n ...

  2. srt编辑的文件在linux显示乱码,修改.srt格式字幕文件

    正文前: 20160821104107 下载了<惊天魔盗团2>电影来看,发现字幕只有英文没有中文.打开.srt文件,随便改了一下,视频那边就会有乱码出现,于是动手搜罗了一下怎么改.srt文 ...

  3. Linux中编辑视频字幕

    我作为一位世界电影和地区电影爱好者已经几十年了.这期间字幕是一个必不可少的工具,它可以使我享受来自不同国家不同语言的优秀电影.如果你喜欢观看带有字幕的电影,你可能会注意到有时字幕并不同步或者说并不正确 ...

  4. 浅谈视频字幕格式---srt格式

    最近在做视频字幕这方面的工作,主要是研究一下字幕格式,搜索后发现有很多相关信息但是看起来太复杂所以这里简单总结一下,留作日后方便查阅,今天主要描述一下srt格式. 1.SRT字幕格式 每个字幕段有四部 ...

  5. 修改.srt格式字幕文件

    2019独角兽企业重金招聘Python工程师标准>>> 正文前: 20160821104107 下载了<惊天魔盗团2>电影来看,发现字幕只有英文没有中文.打开.srt文件 ...

  6. 重磅开源人工智能大型场景草图数据集图像检索草图着色编辑和字幕

    重磅开源人工智能大型场景草图数据集图像检索草图着色编辑和字幕摘要:我们提供了第一个大型场景草图数据集SketchyScene,目的是推进对物体和场景层面的素描研究.该数据集是通过一个新颖且精心设计的众 ...

  7. Sublime Text编辑工具带有 PEP 8 格式检测插件

    Sublime Text编辑工具带有 PEP 8 格式检测插件 转载于:https://www.cnblogs.com/dsdr/p/6045905.html

  8. WPS无法关闭excel表格,提示:关闭窗口前请先退出编辑单元格内容或格式

    WPS无法关闭excel表格,提示关闭窗口前请先退出编辑单元格内容或格式的解决办法: 第一种:按Esc键退出编辑. 第二种:ctrl+alt+delete快捷键打开"任务管理器", ...

  9. 使用剪映提取视频中的字幕并导出(txt或srt格式)

    需要使用剪映电脑版,打开之后 第一步:选择"音频"->"音频提取"->"导入" 在弹出的界面中选择需要的导入的视频,或者直接将视 ...

最新文章

  1. 送你16个matplotlib绘图实用小技巧(附代码)
  2. 《淘宝店铺经营管理一册通》一一1.3 页面中的图片应用
  3. 嵌入式linux mono,嵌入式linux/android alsa_aplay alsa_amixer命令行用法(示例代码)
  4. python中popen的用法_python中的subprocess.Popen()使用
  5. sending data mysql slow Mysql查询非常慢的可能原因
  6. 第22篇 js中的this指针的用法
  7. TP5解析html 回显到页面上
  8. mysql存储过程的正确描述_MySQL存储过程中的基本函数描述
  9. 使用 ESXCLI 命令从主机移除设备
  10. QT中如果出现: warning: 'nullptr' is incompatible with C++98等类似警告
  11. 查询和预测影响因子,这篇文章就够了
  12. MATLAB | 比生命游戏更自由的生命游戏
  13. 质心公式_卢瑟福散射公式
  14. android调色器 源代码,Android 上的调色板 —— Palette
  15. Airbnb面试的27个奇葩问题,你 hold 住吗?
  16. 解决:使用@符号,报错:找不到模块“@”或其响应的类型声明。
  17. 怎样修改linux(虚拟机)系统开机密码
  18. 互联网寒冬!一线互联网移动架构师筑基必备技能之Java篇,附带学习经验
  19. 如何 拆 贴片电容 而不是把焊盘给搞坏
  20. 数组过滤filter()方法

热门文章

  1. 记我Jenkins创建任务时错误
  2. 【计算机毕业设计】147校园失物招领系统
  3. 添加路由 - 批处理
  4. Excel怎么筛选出两列数据、同一行中不同值的行?
  5. 胆固醇高会影响冠心病的病情吗?
  6. C++处理tiff图片--libtiff库(附读写图片代码)
  7. 解C#中的委托(Deligate)
  8. 对不起,来晚了,御姐趣讲设计模式
  9. scrapy立面parse_立面模式在Swift
  10. 领信数科品牌战略升级,引领数字安全行业发展