2009-08-14 73 views
0

我使用下面的C#代码来创建从FLV file.I缩略图正在使用FFMPEG从flash影片中提取缩略图错误而调用FFMPEG,以创建Flash影片缩略图

string inputfile = "D:\\Shyju\\mpgg\\WebSite1\\lss_section3.flv"; 
    string thumbname = "D:\\Shyju\\mpgg\\WebSite1\\test123.jpg"; 
    Process process = new Process(); 
    string thumbargs = "-i \"" + inputfile + "\" -vframes 1 -ss 00:00:07 -s 100x66 \"" + thumbname + "\""; 
    process.StartInfo.FileName = "D:\\Shyju\\newFFMPEG\\ffmpeg.exe"; 
    // string thumbargs = "-i \"" + inputfile + "\" -vframes 1 -ss 00:00:07 -s 100x66 \"" + thumbname + "\""; 
    process.StartInfo.Arguments = thumbargs; 
    //"-i \"D:\\Shyju\\mpgg\\WebSite1\\viva_home.swf\" -an -ss 00:00:03 -s 120×90 -vframes 1 -f mjpeg \"D:\\Shyju\\mpgg\\WebSite1\\testThumbNail.jpg\""; 

    process.StartInfo.UseShellExecute = false; 
    process.StartInfo.RedirectStandardError = true; 
    process.StartInfo.CreateNoWindow = false; 
    process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; 

    process.Start(); 
    string output2 = process.StandardError.ReadToEnd(); 
    process.WaitForExit(); 
    process.Close(); 

当我运行代码,我没有得到预期的缩略图图像。但在变量output2中,我得到以下信息。

ffmpeg version 0.4.9-pre1, build 4751, Copyright (c) 2000-2004 Fabrice Bellard 
    configuration: --enable-memalign-hack --enable-mp3lame --enable-mingw32 --extra-cflags=-I/local/include --extra-ldflags=-L/local/lib --enable-amr_nb 
    built on Mar 29 2005 07:26:02, gcc: 3.2.3 (mingw special 20030504-1) 
[flv @ 0040F954]skipping flv packet: type 18, size 224, flags 0 
[flv @ 0040F954]Unsupported video codec (4) 
[flv @ 0040F954]Unsupported video codec (4) 
[flv @ 0040F954]Unsupported video codec (4) 

//此线有20次以上

[FLV @ 0040F954]不支持的视频编解码器(4)

似乎流1来自胶片源:1000.00(1000/1) - > 0.25(1/4) 来自'D:\ Shyju \ mpgg \ WebSite1 \ lss_section3.flv'的输入#0,flv: 持续时间:N/A,比特率:N/A 流#0.0:音频: mp3,44100 Hz,立体声 Stream#0.1:Video: 无法找到'D:\ Shyju \ mpgg \ WebSite1 \ test123.jpg'

程序正在windows机器上执行。 任何人都可以告诉我什么是我的代码错了吗?

回答

0

Linux下的ffmpeg使用BSD风格选项,因此尝试使用-(1破折号)而不是--(2破折号)来设置选项。