gpt-3.5-turbo-0613· openai
Suzhen/CodeChat
C#实现视频下载并加文字水印 linux平台可用
- User
C#实现视频下载并加文字水印 linux平台可用
- Assistant
以下是使用C#实现视频下载并添加文字水印的示例代码:
using System; using System.Diagnostics; using System.IO; namespace VideoDownloader { class Program { static void Main(string[] args) { string videoUrl = "https://example.com/video.mp4"; string outputPath = "/path/to/save/video.mp4"; string watermarkText = "Hello, World!"; string ffmpegPath = "/path/to/ffmpeg"; // Download video using wget command Console.WriteLine("Downloading video..."); string downloadCommand = $"wget -O \"{outputPath}\" \"{videoUrl}\""; ExecuteCommand(downloadCommand); // Add watermark using ffmpeg command Console.WriteLine("Adding watermark..."); string watermarkCommand = $"{ffmpegPath} -i \"{outputPath}\" -vf \"drawtext=text='{watermarkText}':x=(w-text_w-10):y=(h-text_h-10):fontsize=24:fontcolor=white:shadowcolor=black:shadowx=2:shadowy=2\" -codec:a copy \"{outputPath}_watermarked.mp4\""; ExecuteCommand(watermarkCommand); Console.WriteLine("Video downloaded and watermarked successfully!"); } static void ExecuteCommand(string command) { Process process = new Process(); process.StartInfo.FileName = "/bin/bash"; process.StartInfo.Arguments = $"-c \"{command}\""; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.OutputDataReceived += (s, e) => Console.WriteLine(e.Data); process.ErrorDataReceived += (s, e) => Console.WriteLine(e.Data); process.Start(); process.BeginOutputReadLine(); process.BeginErrorReadLine(); process.WaitForExit(); } } }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.