tags:

views:

730

answers:

2

I am using the below C# code to create a thumbnail image from a flv file.I am using FFMPEG to extract a thumbnail image from the flash movie

    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();

when i run the code,I am not getting the thumbnail image as expected .But in the variable output2, i am getting the below information.

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)

// this line comes more than 20 times

[flv @ 0040F954]Unsupported video codec (4)

Seems that stream 1 comes from film source: 1000.00 (1000/1) -> 0.25 (1/4) Input #0, flv, from 'D:\Shyju\mpgg\WebSite1\lss_section3.flv': Duration: N/A, bitrate: N/A Stream #0.0: Audio: mp3, 44100 Hz, stereo Stream #0.1: Video: Unable for find a suitable output format for 'D:\Shyju\mpgg\WebSite1\test123.jpg'

The program is being executed in a windows machine. Can anyone tell me whats wrong with my code ?

A: 

ffmpeg under Linux uses BSD style options, therefore try setting options with - (1 dash) instead of -- (2 dashes).

Residuum
A: 

if i remember correctly the output filename has to be test%d.jpg - the %d will automatically be filled in. see http://ffmpeg.org/faq.html#SEC21 that should to the trick (the error msg is wrong) see i.e. http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2005-May/000696.html

Niko
Added %d in the thumbnail file name.But no response.
Shyju