当前位置: 首页 > news >正文

c#winform,倒鸭子字幕效果,typemonkey字幕效果,抖音瀑布流字幕效果

不废话 直接上效果图
C# winform 开发抖音的瀑布流字幕。
也是typemonkey插件字幕效果
或者咱再网上常说的倒鸭子字幕效果

主要功能

1,软件可以自定义添加字幕内容
2,软件可以添加字幕显示的时间区间
3,可以自定义字幕颜色,可以随机颜色
4,支持字幕的上下调节
5,支持字幕的删除行和清空
6,支持字幕的导出和导入
7,支持上传背景音乐mp3
8,支持更换背景颜色和背景图片
9,支持导入srt字幕文件,也就是剪映导出的字幕文件,这样能有效的把字幕和口播的音频进行对齐。
10,可以自定义字幕的字体。

下面给大家展示一下功能图片

         // 定义内容文本数组,调整了每行字幕的持续时间
         let contentTexts = [
            { "inPoint": 0, "outPoint": 1500, "content": "嘟", "color": "#FF0000", "fontFamily": "Microsoft YaHei"},
            { "inPoint": 1500, "outPoint": 3000, "content": "您好", "color": "#33FF57", "fontFamily": "字由点字墩墩体"},
            { "inPoint": 3000, "outPoint": 4500, "content": "您是大法师吗?", "fontFamily": "抖音美好体"},
            { "inPoint": 4500, "outPoint": 6000, "content": "哎", "color": "#3357FF", "fontFamily": "抖音美好体"},
            { "inPoint": 6000, "outPoint": 7500, "content": "1212哎", "color": "#3357FF", "fontFamily": "Microsoft YaHei"},
            { "inPoint": 7500, "outPoint": 9000, "content": "哎222222", "color": "#3357FF", "fontFamily": "抖音美好体"},
            { "inPoint": 9000, "outPoint": 10500, "content": "哎3333333333", "color": "#3357FF", "fontFamily": "Microsoft YaHei"},
            { "inPoint": 10500, "outPoint": 12000, "content": "3333哎", "color": "#3357FF", "fontFamily": "Arial"},
            { "inPoint": 12000, "outPoint": 13500, "content": "22222222222222哎", "color": "#3357FF", "fontFamily": "抖音美好体"},
            { "inPoint": 13500, "outPoint": 15000, "content": "哎", "color": "#3357FF", "fontFamily": "Arial"},
            { "inPoint": 15000, "outPoint": 18000, "content": "111111111111111哎", "color": "#3357FF", "fontFamily": "Arial"},
        ];	

例如 导入srt文件的c# 代码
 

      private void ParseSRTFile(string filePath)
        {
            string[] lines = File.ReadAllLines(filePath);
            dgv_lens.Rows.Clear(); // Clear existing rows
                                   // Temporary variables for SRT parsing
            string currentContent = "";
            TimeSpan inPoint = TimeSpan.Zero;
            TimeSpan outPoint = TimeSpan.Zero;
            Random random = new Random();
            string[] colors = new string[]
            {
        "#5AAEF3", "#62D9AD", "#5B6E96", "#a8dffa", "#ffdc4c",
        "#FF974C", "#E65A56", "#6D61E4", "#4A6FE2", "#6D9AE7",
        "#23C2DB", "#D4EC59", "#FFE88E", "#FEB64D", "#FB6E6C"
            };
            // Parsing logic
            for (int i = 0; i < lines.Length; i++)
            {
                string line = lines[i].Trim();
                // Check for time code
                if (line.Contains("-->"))
                {
                    // Split the time codes
                    var timeCodes = line.Split(new[] { " --> " }, StringSplitOptions.None);
                    if (timeCodes.Length == 2)
                    {
                        try
                        {
                           
                            inPoint = TimeSpan.ParseExact(timeCodes[0].Trim(), @"hh\:mm\:ss\,fff", CultureInfo.InvariantCulture);
                            outPoint = TimeSpan.ParseExact(timeCodes[1].Trim(), @"hh\:mm\:ss\,fff", CultureInfo.InvariantCulture);
                        }
                        catch (FormatException ex)
                        {
                            MessageBox.Show($"Error parsing time codes: {ex.Message}", "Parsing Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return; 
                        }
                    }
                }
                else if (!string.IsNullOrEmpty(line) && !line.All(char.IsDigit))
                {
                    // This line is the content
                    currentContent = line;
                    // Add the row to the DataGridView
                    int index = dgv_lens.Rows.Add();
                    dgv_lens.Rows[index].Cells[0].Value = currentContent;
                    dgv_lens.Rows[index].Cells[1].Value = cbRandomColor.Checked ? colors[random.Next(colors.Length)] : lbTextColor.Tag.ToString();
                    dgv_lens.Rows[index].Cells[2].Value = (int)inPoint.TotalMilliseconds; // Convert TimeSpan to milliseconds
                    dgv_lens.Rows[index].Cells[3].Value = (int)outPoint.TotalMilliseconds; // Convert TimeSpan to milliseconds
                    dgv_lens.Rows[index].Cells[4].Value = cbFonts.Text; // Current font selection
                }
            }
            MessageBox.Show("SRT file imported successfully!", "Import Successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

http://www.dtcms.com/a/99322.html

相关文章:

  • uniapp中的流式输出
  • 蓝桥杯 14 天 十五届蓝桥杯 数字诗意
  • 雨云云应用测评!内测持续进行中!
  • 深度学习中常见的专业术语汇总
  • SQL Server 可用性组自动种子设定失败问题
  • .NET开发基础知识1-10
  • 无人机宽带自组网机载电台技术详解,50KM超远图数传输系统实现详解
  • Python控制结构详解
  • 群体智能优化算法-流向算法(Flow Direction Algorithm, FDA,含Matlab源代码)
  • FALL靶机渗透实战:从信息收集到特权升级的完整链分析
  • postgresql 重置对应表序列最大值
  • 药用植物次生代谢的多层调控-文献精读123
  • 如何利用<ruby>、<rt>、<rp>标签实现中文注音或字符注释?
  • 车载以太网网络测试 -25【SOME/IP-报文格式-1】
  • AI助力高效办公:如何利用AI制作PPT提升工作效率
  • RAG模型
  • 医疗CMS高效管理:简化更新维护流程
  • Open HarmonyOS 5.0 分布式软总线子系统 (DSoftBus) 详细设计与运行分析报告
  • 自动化测试知识详解
  • RuoYi基础学习
  • 拦截器和过滤器详解
  • 前端D3.js面试题及参考答案
  • Linux安装Cmake (Centos 7.9)
  • Python小练习系列 Vol.3:生成有效括号组合(回溯 + DFS)
  • 【15】Selenium 爬取实战
  • stringstream的使用
  • d2025329
  • PyGame开发贪吃蛇小游戏
  • Hive SQL中 ?+.+ 的用法,字段剔除
  • 在Qt中判断输入的js脚本是否只包含函数