Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
ffmpeg creates empty flv files
8 janvier 2012, par user1136924I'm trying to build avi to flv converter with c#. i'm using this code below (taken from here) but it produces empty flv files. please help figure this this out.
on an button click the program takes the uploaded file from the upload box and creates a new flv file from it.
thanks!
protected void btn_Submit_Click(object sender, EventArgs e) { ReturnVideo(this.fileuploadImageVideo.FileName); } private bool ReturnVideo(string fileName) { string html = string.Empty; //rename if file already exists int j = 0; string AppPath; string inputPath; string outputPath; string imgpath; AppPath = Request.PhysicalApplicationPath; //Get the application path inputPath = AppPath + "OriginalVideo"; //Path of the original file outputPath = AppPath + "ConvertVideo"; //Path of the converted file imgpath = AppPath + "Thumbs"; //Path of the preview file string filepath = Server.MapPath("~/OriginalVideo/" + fileName); while (File.Exists(filepath)) { j = j + 1; int dotPos = fileName.LastIndexOf("."); string namewithoutext = fileName.Substring(0, dotPos); string ext = fileName.Substring(dotPos + 1); fileName = namewithoutext + j + "." + ext; filepath = Server.MapPath("~/OriginalVideo/" + fileName); } try { this.fileuploadImageVideo.SaveAs(filepath); } catch { return false; } string outPutFile; outPutFile = "~/OriginalVideo/" + fileName; int i = this.fileuploadImageVideo.PostedFile.ContentLength; System.IO.FileInfo a = new System.IO.FileInfo(Server.MapPath(outPutFile)); while (a.Exists == false) { } long b = a.Length; while (i != b) { } string cmd = " -i \"" + inputPath + "\\" + fileName + "\" \"" + outputPath + "\\" + fileName.Remove(fileName.IndexOf(".")) + ".flv" + "\""; ConvertNow(cmd); string imgargs = " -i \"" + outputPath + "\\" + fileName.Remove(fileName.IndexOf(".")) + ".flv" + "\" -f image2 -ss 1 -vframes 1 -s 280x200 -an \"" + imgpath + "\\" + fileName.Remove(fileName.IndexOf(".")) + ".jpg" + "\""; ConvertNow(imgargs); return true; } private void ConvertNow(string cmd) { string exepath; string AppPath = Request.PhysicalApplicationPath; //Get the application path exepath = AppPath + "ffmpeg.exe"; System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = exepath; //Path of exe that will be executed, only for "filebuffer" it will be "flvtool2.exe" proc.StartInfo.Arguments = cmd; //The command which will be executed proc.StartInfo.UseShellExecute = false; proc.StartInfo.CreateNoWindow = true; proc.StartInfo.RedirectStandardOutput = false; proc.Start(); while (proc.HasExited == false) { } }
-
playing ffmpeg in android
8 janvier 2012, par JohnI am developing an android project in which i need to play ffmpeg format videos.I think android doesn't support ffmpeg formats.
I have downloaded ffmpeg codec and loaded the library "libffmpeg.so" in my project using android ndk and JNI.
Now,how can i use this "libffmpeg.so" to play those video formats.
My project directory structure is like this.
Any one please help.
-
Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
7 janvier 2012, par Rocky SinghI am trying to convert an avi video file to flv format via FFMPEG with the following command:
-i C:\files\input\test.avi -y -ab 448k -ar 48000 -vcodec mpeg4 -s 640x480 -f flv C:\files\output\test.flv
Here is the response I am getting from ffmpeg:
Input:
Input #0, avi, from 'C:\files\input\test.avi': Metadata: encoder : VirtualDubMod 1.5.10.2 (build 2540/release) Duration: 00:01:00.00, start: 0.000000, bitrate: 1813 kb/s Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 640x272 [SAR 1:1 DAR 40:17], 25 tbr, 25 tbn, 25 tbc Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), s16, 448 kb/s
Output:
Output #0, flv, to 'C:\files\output\test.flv': Metadata: encoder : VirtualDubMod 1.5.10.2 (build 2540/release) Stream #0:0: Video: mpeg4, yuv420p, 640x480 [SAR 30:17 DAR 40:17], q=2-31, 200 kb/s, 90k tbn, 25 tbc Stream #0:1: Audio: mp3, 48000 Hz, 5.1(side), s16, 448 kb/s Stream mapping: Stream #0:0 -> #0:0 (mpeg4 -> mpeg4) Stream #0:1 -> #0:1 (ac3 -> libmp3lame) Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
Can you tell me what is MAY BE here? and what is wrong above?
-
Converting videos to flv using ffmpeg
6 janvier 2012, par user703526In my c# application, i am writing code for converting any video format to flv format. For this FFMPEG is used.
Some times an exceptions is occuring like:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt
Below is my code from where the exception throwing,
IntPtr pFormatContext; FFmpeg.av_register_all(); int ret; ret = FFmpeg.av_open_input_file(out pFormatContext, this.Filename, IntPtr.Zero, 0, IntPtr.Zero); if (ret < 0) { Trace.WriteLine("couldn't open input file"); FFmpeg.av_free_static(); return; } try { ret = FFmpeg.av_find_stream_info(pFormatContext); if (ret < 0) { Trace.WriteLine("couldnt find stream informaion"); FFmpeg.av_close_input_file(pFormatContext); FFmpeg.av_free_static(); return; } FFmpeg.AVFormatContext formatContext = (FFmpeg.AVFormatContext)Marshal.PtrToStructure(pFormatContext, typeof(FFmpeg.AVFormatContext)); Duration = formatContext.duration / FFmpeg.AV_TIME_BASE; for (int i = 0; i < formatContext.nb_streams; ++i) { FFmpeg.AVStream stream = (FFmpeg.AVStream)Marshal.PtrToStructure(formatContext.streams[i], typeof(FFmpeg.AVStream)); FFmpeg.AVCodecContext codec = (FFmpeg.AVCodecContext)Marshal.PtrToStructure(stream.codec, typeof(FFmpeg.AVCodecContext)); if (codec.codec_type == FFmpeg.CodecType.CODEC_TYPE_VIDEO) { Height = codec.height; Width = codec.width; Type = FileType.flv; MimeType = "video/x-flv"; } } } catch (Exception ex) { Trace.WriteLine("FFMpeg failed to understand the file"); } FFmpeg.av_close_input_file(pFormatContext); FFmpeg.av_free_static(); }
And from the above code this
ret = FFmpeg.av_find_stream_info(pFormatContext);
line throws memory corrupt exception. Please help me to solve this issue. -
FFmpeg vs Libav ?
6 janvier 2012, par Shimmy