Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
ffmpeg seems to be capping my output
11 septembre 2012, par Kurt SpindlerI'm trying to extract individual frames from a video.
ffmpeg -i face_source.wmv face_sourceframes/image%03d.jpg
is almost working just fine. The first six or so appear perfect (have roughly 30kB file size), but then they continuously degrade (e.g. 23kB, 17kB, etc.) until all frames are 11kB. Of course, these frames are pixelated and not desired.
I tried forcing a bitrate with the
-b
option. ffmpeg tells me this about the inupt video:Duration: 00:00:10.07, start: 0.000000, bitrate: 781 kb/s
So I set bitrate, first using
-b 781k
, and then, just to be safe, also tried doubling it, to-b 1562k
. Neither of these options made any apparent difference in the output.Any help would be appreciated! Thank you!
-
how to provide login username and password to ffmpeg ?
11 septembre 2012, par Lynxhow can i provide username and password to ffmpeg to enable it to write data to some folder in ftp server? the folder is protected by password and if possible i dont want to remove that password. so, can i simply just pass the password to ffmpeg? or is there any other solutions?
example of ffmpeg process to create thumbnail from video file
string thumbpath, thumbname, videofile; videofile = "Video Source path"; thumbpath = "thumbnail path"; thumbname = thumbpath + "20120910160600.mjpeg"; string thumbargs = "-i \"" + videofile + "\" -vframes 1 -s 60*30 -ss 00:00:00 -f image2 \"" + thumbname + "\""; Process process = new Process(); process.StartInfo.FileName = Server.MapPath("~\\ffmpeg\\bin\\ffmpeg.exe"); process.StartInfo.Arguments = thumbargs; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardInput = false; process.StartInfo.RedirectStandardError = true; process.StartInfo.CreateNoWindow = false; process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
New Learner, Please guide me....
-
ffmpeg terminates without any output
11 septembre 2012, par KhanI am using ffmpeg to convert a video file to mp4. here is my code
echo "converting ".basename($src)." --- to --- ".basename($dest).".mp4...
"; $command = FFMPEG.' -i ' . $src . ' -sameq -strict -2 -vcodec libx264 -ar 22050 -y ' . $dest.'.mp4 2>&1'; // echo $command.'
'; exec($command,$output,$status); echo '',join('
',$output),'
'; if($status == 0) { // Success echo 'Successfully converted to MP4!
'; } else { echo $status."
failed
"; }The code works fine on my localhost (Windows 7 + wamp).. But on live server , only $command is echoed.. and script is terminated. The output file is generated but it is only 4.5MB (it should be around 17 MB) and not complete... and sometime I get the following output..
ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers built on Sep 10 2012 00:38:24 with gcc 4.1.2 20080704 (Red Hat 4.1.2-52) configuration: --prefix=/home/one01qsc/local --extra-cflags='-L/home/one01qsc/local/lib/ -I /home/one01qsc/local/include/' --extra-ldflags='-L/home/one01qsc/local/lib/ -Wl,-rpath,/home/one01qsc/local/lib/' --enable-libmp3lame --enable-libvorbis --enable-shared --disable-yasm --enable-libtheora --enable-libx264 --enable-gpl libavutil 51. 54.100 / 51. 54.100 libavcodec 54. 23.100 / 54. 23.100 libavformat 54. 6.100 / 54. 6.100 libavdevice 54. 0.100 / 54. 0.100 libavfilter 2. 77.100 / 2. 77.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 15.100 / 0. 15.100 libpostproc 52. 0.100 / 52. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/one01qsc/public_html/temp/pending/1455-testing-mobidick.mov': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt creation_time : 2012-09-08 16:00:41 Duration: 00:00:23.13, start: 0.490000, bitrate: 6028 kb/s Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 5331 kb/s, 29.97 fps, 29.97 tbr, 60k tbn, 59.94 tbc Metadata: creation_time : 2012-09-08 16:00:41 handler_name : Apple Alias Data Handler Stream #0:1: Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 192 kb/s Metadata: creation_time : 2012-09-08 16:00:41 handler_name : Apple Alias Data Handler [buffer @ 0x2405ce0] w:1920 h:1080 pixfmt:yuv420p tb:1/60000 sar:0/1 sws_param:flags=2 [buffersink @ 0x2429ec0] No opaque field provided [aformat @ 0x23fa560] auto-inserting filter 'auto-inserted resampler 0' between the filter 'src' and the filter 'aformat' [aresample @ 0x2402e60] chl:stereo fmt:s16 r:44100Hz -> chl:stereo fmt:flt r:22050Hz [libx264 @ 0x24288e0] using cpu capabilities: none! [libx264 @ 0x24288e0] profile High, level 4.0 [libx264 @ 0x24288e0] 264 - core 128 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=24 lookahead_threads=4 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to '/home/one01qsc/public_html/temp/1455-testing-mobidick.mp4': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt creation_time : 2012-09-08 16:00:41 encoder : Lavf54.6.100 Stream #0:0: Video: h264 (![0][0][0] / 0x0021), yuv420p, 1920x1080, q=-1--1, 30k tbn, 29.97 tbc Metadata: creation_time : 2012-09-08 16:00:41 handler_name : Apple Alias Data Handler Stream #0:1: Audio: aac (@[0][0][0] / 0x0040), 22050 Hz, stereo, flt, 128 kb/s Metadata: creation_time : 2012-09-08 16:00:41 handler_name : Apple Alias Data Handler Stream mapping: Stream #0:0 -> #0:0 (h264 -> libx264) Stream #0:1 -> #0:1 (aac -> aac) Press [q] to stop, [?] for help frame= 18 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate= 0.0kbits/s
the value printed for $status is 137 in this case.
Any help is really appreciated.
-
how to pass ffmpeg output to other sub-class in C# ?
11 septembre 2012, par Lynxi want to pass the thumbnail generated by ffmpeg to save_FTPUpload where the save_FTPUpload function is to upload the image file to ftp server. how can i do that? here is my example code for thumbnail generation using ffmpeg and "fileupload" function for uploading files to ftp server:
public partial class testtttt : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { generateThumbnail(); string fi_attachment = @"C:\2.jpg";//source image file save_FTPUpload(fi_attachment); } private void generateThumbnail() { string thumbpath, thumbname, videofile; videofile = "http://www.xxxx.com/video.Avi"; thumbpath = @"C:\"; thumbname = thumbpath + Path.GetFileNameWithoutExtension(videofile) + ".jpg"; string thumbargs = "-i \"" + videofile + "\" -vframes 1 -s 60*30 -ss 00:00:00 -f image2 \"" + thumbname + "\""; Process process = new Process(); process.StartInfo.FileName = Server.MapPath("~\\ffmpeg\\bin\\ffmpeg.exe"); process.StartInfo.Arguments = thumbargs; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardInput = false; process.StartInfo.RedirectStandardError = true; process.StartInfo.CreateNoWindow = false; process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; try { process.Start(); string output2 = process.StandardError.ReadToEnd(); string output3 = process.StandardOutput.ReadToEnd(); if (process != null) { process.Close(); } } catch (Exception) { this.lblMessage.Text = "Thumbnail created successfuly";//ex.Message.ToString(); } } public bool save_FTPUpload(string fi_attachment) { bool fileSaved = false; //string fi_attachment = @"C:\1.jpg"; string filename = "3.jpg";//image name to be saved in ftp string ftp_user = "*****"; //username string ftp_pass = "*****"; //password string ftpURI = "ftp://www.xxxx.com/thumb/"; //ftp path where the image will be saved while (!fileSaved) { string file_ftpURI = string.Format("{0}/{1}", ftpURI, filename); FtpWebRequest file_exist_request = (FtpWebRequest)FtpWebRequest.Create(file_ftpURI); file_exist_request.Credentials = new NetworkCredential(ftp_user, ftp_pass); file_exist_request.Method = WebRequestMethods.Ftp.GetFileSize; try { FtpWebResponse response = (FtpWebResponse)file_exist_request.GetResponse(); } catch (WebException ex) { FtpWebResponse response = (FtpWebResponse)ex.Response; if (response.StatusCode == FtpStatusCode.ActionNotTakenFileUnavailable) { FtpWebRequest upload_request = (FtpWebRequest)FtpWebRequest.Create(file_ftpURI); upload_request.Credentials = new NetworkCredential(ftp_user, ftp_pass); upload_request.Method = WebRequestMethods.Ftp.UploadFile; upload_request.UsePassive = true; upload_request.UseBinary = true; upload_request.KeepAlive = false; using (var fs = File.OpenRead(fi_attachment)) using (Stream upload_request_stream = upload_request.GetRequestStream()) { fs.CopyTo(upload_request_stream); } FtpWebResponse upload_response = (FtpWebResponse)upload_request.GetResponse(); fileSaved = true; this.Label1.Text = "Upload Successful"; } } } return fileSaved; }
-
MIME type for transcoded stream
11 septembre 2012, par Matt JoinerI wish to determine the MIME type of the contents of a pipe. The pipe is outputting a transcoded video stream, so there is no corresponding file extension.
Can I determine the MIME type in these circumstances using say
ffprobe -i pipe:0
or some equivalent? Is there a canonical mapping of codecs or container formats to MIME type?