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

不废话 直接上效果图

C# winform 开发抖音的瀑布流字幕。

也是typemonkey插件字幕效果

或者咱再网上常说的倒鸭子字幕效果

主要功能

1,软件可以自定义添加字幕内容

2,软件可以添加字幕显示的时间区间

3,可以自定义字幕颜色,可以随机颜色

4,支持字幕的上下调节

5,支持字幕的删除行和清空

6,支持字幕的导出和导入

7,支持上传背景音乐mp3

8,支持更换背景颜色和背景图片

9,支持导入srt字幕文件,也就是剪映导出的字幕文件,这样能有效的把字幕和口播的音频进行对齐。

10,可以自定义字幕的字体。

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

javascript 复制代码
         // 定义内容文本数组,调整了每行字幕的持续时间
         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# 代码

cs 复制代码
      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);
        }
相关推荐
阿珊和她的猫3 小时前
v-scale-scree: 根据屏幕尺寸缩放内容
开发语言·前端·javascript
fouryears_234176 小时前
Flutter InheritedWidget 详解:从生命周期到数据流动的完整解析
开发语言·flutter·客户端·dart
我好喜欢你~6 小时前
C#---StopWatch类
开发语言·c#
lifallen7 小时前
Java Stream sort算子实现:SortedOps
java·开发语言
IT毕设实战小研7 小时前
基于Spring Boot 4s店车辆管理系统 租车管理系统 停车位管理系统 智慧车辆管理系统
java·开发语言·spring boot·后端·spring·毕业设计·课程设计
cui__OaO9 小时前
Linux软件编程--线程
linux·开发语言·线程·互斥锁·死锁·信号量·嵌入式学习
鱼鱼说测试9 小时前
Jenkins+Python自动化持续集成详细教程
开发语言·servlet·php
艾莉丝努力练剑10 小时前
【洛谷刷题】用C语言和C++做一些入门题,练习洛谷IDE模式:分支机构(一)
c语言·开发语言·数据结构·c++·学习·算法
一阵没来由的风10 小时前
拒绝造轮子(C#篇)ZLG CAN卡驱动封装应用
c#·can·封装·zlg·基础封装·轮子
CHEN5_0210 小时前
【Java基础面试题】Java基础概念
java·开发语言