最近看下载了些英文电影,想参照英文字幕来看,结果下载的英文字幕和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. 4,list,list的列表嵌套,range
  2. 096_JavaScript事件
  3. 包r语言_R语言代码共享:制作R包
  4. hdu 4810 Wall Painting
  5. 实战演练丨SCN太大引发ORA-600[2252]
  6. 【COCA】美国当代语料库常用高频词汇20200个(可直接复制)
  7. 剪辑视频,垂直翻转如何实现
  8. unity光照烘焙怎么弄
  9. github用户followers分析
  10. 【OpenCV入门教程之十一】 形态学图像处理(二):开运算、闭运算、形态学梯度、顶帽、黑帽合辑
  11. 少爷的云台山漂流记:山崖水畔的狂欢
  12. Uedit32-视图-查看方式(高亮),显示失效.
  13. AtCoder Beginner Contest 175 E.Picking Goods
  14. 40个Java多线程问题总结(摘抄至五月的仓颉的博客)
  15. mysql主备同步错误:Last_Error: Could not execute Update_rows event; Error_code: 1032;
  16. 现代化小区建筑规划设计的问题
  17. 超强配置 索爱A5无线蓝牙耳机重磅来袭
  18. Win10 设置显示 ClearType 的设置
  19. 第十一节、轻松学Java_泛型
  20. 【Android自动化测试】Ui Automator技术(以对QQ软件自动发说说为例)

热门文章

  1. JavaScript (JS)常见数据结构与算法的封装
  2. 【直播预告】CIKM 2022 论文分享:多场景个性化推荐的场景自适应自监督模型
  3. python基础语法--python语言及其应用
  4. 思科实验-3.3.1.5-Packet Tracer - 配置 PVST+
  5. R语言使用glm函数构建泊松对数线性回归模型处理三维列联表数据构建饱和模型、使用step函数基于AIC指标实现逐步回归筛选最佳模型、使用summary函数查看简单模型的汇总统计信息
  6. 名帖79 苏轼 楷书《醉翁亭记》
  7. 统计学和大数据如何帮助我们认知世界?
  8. 北京工业大学c语言网上作业,北京工业大学C语言部分练习答案.pdf
  9. 慈母手中线,游子身上衣
  10. 查询内容在网页里面分页显示+跳页查看