Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • Android : Creating video from images [closed]

    9 août 2013, par Raj

    I am working on an Android app where I want to create a video from a list of static images. After doing some search on internet, it made me realized that using "FFMPEG" is the way to go in getting this thing done. So I got hold of this site: https://github.com/guardianproject/android-ffmpeg-java from where I downloaded the C library and the Java wrapper. I was able to compile the C library - of course not the way the instruction was laid out - but still I was able to get "ffmpeg" executable under /external/android-ffmpeg/ffmpeg directory. I copied that executable in my current directory and then copied it to a directory under Android where my app can access it. Then I called the Java wrapper provided but I am seeing some errors in the log file like follows:

    08-09 17:01:12.374: D/FFMPEG(19369): /data/data/com.sample/files/ffmpeg/ffmpeg -y -i /data/data/com.sample/files/usersnapshot/ffmpeg/image-001.jpg /data/data/com.sample/files/usersnapshot/ffmpeg/image-000.jpg 
    08-09 17:01:12.404: I/ShellCallback : shellOut()(19369): /data/data/com.sample/files/ffmpeg/ffmpeg[1]: syntax error: '(' unexpected
    08-09 17:01:12.464: I/ShellCallback : processComplete()(19369): 1
    08-09 17:01:12.534: D/FFMPEG(19369): /data/data/com.sample/files/ffmpeg/ffmpeg -y -i /data/data/com.sample/files/usersnapshot/ffmpeg/image-001.jpg /data/data/com.sample/files/usersnapshot/ffmpeg/image-001.jpg 
    08-09 17:01:12.584: I/ShellCallback : shellOut()(19369): /data/data/com.sample/files/ffmpeg/ffmpeg[1]: syntax error: '(' unexpected
    08-09 17:01:12.584: I/ShellCallback : processComplete()(19369): 1
    08-09 17:01:12.624: D/FFMPEG(19369): /data/data/com.sample/files/ffmpeg/ffmpeg -y -i /data/data/com.sample/files/usersnapshot/ffmpeg/image-002.jpg /data/data/com.sample/files/usersnapshot/ffmpeg/image-002.jpg 
    08-09 17:01:12.654: I/ShellCallback : shellOut()(19369): /data/data/com.sample/files/ffmpeg/ffmpeg[1]: syntax error: '(' unexpected
    08-09 17:01:12.654: I/ShellCallback : processComplete()(19369): 1
    08-09 17:01:12.694: D/FFMPEG(19369): /data/data/com.sample/files/ffmpeg/ffmpeg -y -i /data/data/com.sample/files/usersnapshot/ffmpeg/image-003.jpg /data/data/com.sample/files/usersnapshot/ffmpeg/image-003.jpg 
    08-09 17:01:12.734: I/ShellCallback : shellOut()(19369): /data/data/com.sample/files/ffmpeg/ffmpeg[1]: syntax error: '(' unexpected
    08-09 17:01:12.734: I/ShellCallback : processComplete()(19369): 1
    08-09 17:01:12.774: D/FFMPEG(19369): /data/data/com.sample/files/ffmpeg/ffmpeg -y -i /data/data/com.sample/files/usersnapshot/ffmpeg/image-004.jpg /data/data/com.sample/files/usersnapshot/ffmpeg/image-004.jpg 
    08-09 17:01:12.804: I/ShellCallback : shellOut()(19369): /data/data/com.sample/files/ffmpeg/ffmpeg[1]: syntax error: '(' unexpected
    08-09 17:01:12.804: I/ShellCallback : processComplete()(19369): 1
    08-09 17:01:12.854: D/FFMPEG(19369): /data/data/com.sample/files/ffmpeg/ffmpeg -y -i /data/data/com.sample/files/usersnapshot/ffmpeg/image-005.jpg /data/data/com.sample/files/usersnapshot/ffmpeg/image-005.jpg 
    08-09 17:01:12.915: I/ShellCallback : shellOut()(19369): /data/data/com.sample/files/ffmpeg/ffmpeg[1]: syntax error: '(' unexpected
    08-09 17:01:12.915: I/ShellCallback : processComplete()(19369): 1
    08-09 17:01:12.955: D/FFMPEG(19369): /data/data/com.sample/files/ffmpeg/ffmpeg -y -i /data/data/com.sample/files/usersnapshot/ffmpeg/image-006.jpg /data/data/com.sample/files/usersnapshot/ffmpeg/image-006.jpg 
    08-09 17:01:13.005: I/ShellCallback : shellOut()(19369): /data/data/com.sample/files/ffmpeg/ffmpeg[1]: syntax error: '(' unexpected
    08-09 17:01:13.005: I/ShellCallback : processComplete()(19369): 1
    08-09 17:01:13.055: D/FFMPEG(19369): /data/data/com.sample/files/ffmpeg/ffmpeg -y -i /data/data/com.sample/files/usersnapshot/ffmpeg/image-007.jpg /data/data/com.sample/files/usersnapshot/ffmpeg/image-007.jpg 
    08-09 17:01:13.125: I/ShellCallback : shellOut()(19369): /data/data/com.sample/files/ffmpeg/ffmpeg[1]: syntax error: '(' unexpected
    08-09 17:01:13.125: I/ShellCallback : processComplete()(19369): 1
    08-09 17:01:13.185: D/FFMPEG(19369): /data/data/com.sample/files/ffmpeg/ffmpeg -y -i /data/data/com.sample/files/usersnapshot/ffmpeg/image-008.jpg /data/data/com.sample/files/usersnapshot/ffmpeg/image-008.jpg 
    08-09 17:01:13.255: I/ShellCallback : shellOut()(19369): /data/data/com.sample/files/ffmpeg/ffmpeg[1]: syntax error: '(' unexpected
    08-09 17:01:13.255: I/ShellCallback : processComplete()(19369): 1
    08-09 17:01:13.315: D/FFMPEG(19369): /data/data/com.sample/files/ffmpeg/ffmpeg -y -loop 0 -f image2 -r 1/2 -i /data/data/com.sample/files/usersnapshot/ffmpeg/image-%03d.jpg -strict -2 /data/data/com.sample/files/usersnapshot/ffmpeg/tmp.mpg 
    08-09 17:01:13.375: I/ShellCallback : shellOut()(19369): /data/data/com.sample/files/ffmpeg/ffmpeg[1]: syntax error: '(' unexpected
    08-09 17:01:13.375: I/ShellCallback : processComplete()(19369): 1
    08-09 17:01:13.435: D/FFMPEG(19369): /data/data/com.sample/files/ffmpeg/ffmpeg -y -i /data/data/com.sample/files/usersnapshot/ffmpeg/tmp.mpg -strict -2 -vcodec mpeg4 /storage/emulated/0/video/snapshot-video.mp4 
    08-09 17:01:13.495: I/ShellCallback : shellOut()(19369): /data/data/com.sample/files/ffmpeg/ffmpeg[1]: syntax error: '(' unexpected
    08-09 17:01:13.505: I/ShellCallback : processComplete()(19369): 1
    

    And following is the code snippet (where targetDirectoryForFFMPEG = directory where the images are stored):

    import org.ffmpeg.android.FfmpegController;
    import org.ffmpeg.android.MediaDesc;
    import org.ffmpeg.android.ShellUtils.ShellCallback;
    
    ...
    ...
    
    FfmpegController ffmpegController = new FfmpegController(this, targetDirectoryForFFMPEG);           
            MediaDesc out = new MediaDesc();
            out.path = videoOutPutFile.getPath();
            ffmpegController.createSlideshowFromImagesAndAudio(listOfMediaDesc, null, out, 2, new ShellCallback() {
    
                @Override
                public void shellOut(String shellLine) {
                    Log.i("ShellCallback : shellOut()", shellLine);
                }
    
                @Override
                public void processComplete(int exitValue) {
                    Log.i("ShellCallback : processComplete()", exitValue+"");
                }
            });
    

    Has anybody implemented this before? If yes, can you point me to what am I doing incorrect? I will provide more information if needed.

  • FFmpeg CPU utilization

    9 août 2013, par user2565986

    I have a server running Scientific Linux. I'm trying to convert a large amount of videos and want to maximize cpu usage. My ffmpeg version is git-2013-08-06-a68b6ec.

    FFmpeg command:

    ffmpeg -y -i "$i" -c:v libx264 -preset fast -b:v "$VID_BIT" -threads 0 -c:a libfdk_aac -b:a "$AUD_BIT" -f mp4 /"$OUT_DIR"/"$MD5"

    top output:

    top - 10:47:25 up 3 days, 22:05,  5 users,  load average: 1.94, 0.49, 0.16
    Tasks: 578 total,   1 running, 574 sleeping,   3 stopped,   0 zombie
    Cpu0  :  0.0%us,  0.6%sy, 63.2%ni, 36.1%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu1  :  0.0%us,  0.6%sy, 60.1%ni, 39.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu2  :  0.0%us,  0.3%sy, 59.5%ni, 40.1%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu3  :  0.0%us,  0.6%sy, 57.1%ni, 42.2%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu4  :  0.0%us,  0.3%sy, 55.0%ni, 44.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu5  :  0.0%us,  0.6%sy, 50.2%ni, 49.2%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu6  :  0.0%us,  0.3%sy, 56.4%ni, 43.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu7  :  0.0%us,  0.6%sy, 50.3%ni, 49.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu8  :  0.0%us,  0.6%sy, 47.7%ni, 51.6%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu9  :  0.3%us,  0.3%sy, 46.8%ni, 52.6%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu10 :  0.0%us,  0.3%sy, 50.2%ni, 49.5%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu11 :  0.0%us,  0.7%sy, 49.0%ni, 50.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu12 :  0.0%us,  0.6%sy, 49.4%ni, 50.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu13 :  0.0%us,  0.6%sy, 43.2%ni, 56.1%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu14 :  0.0%us,  0.3%sy, 44.5%ni, 55.2%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu15 :  0.0%us,  0.6%sy, 46.3%ni, 53.1%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu16 :  0.0%us,  0.7%sy, 44.6%ni, 54.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu17 :  0.0%us,  0.3%sy, 43.3%ni, 56.4%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu18 :  0.0%us,  0.3%sy, 41.6%ni, 58.1%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu19 :  0.0%us,  0.3%sy, 34.3%ni, 65.4%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu20 :  0.0%us,  0.6%sy, 32.5%ni, 66.9%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu21 :  0.0%us,  0.3%sy, 37.9%ni, 61.4%id,  0.3%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu22 :  0.0%us,  0.3%sy, 36.9%ni, 62.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu23 :  0.0%us,  1.0%sy, 37.6%ni, 61.4%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Mem:  198345032k total, 10135568k used, 188209464k free,   144212k buffers
    Swap: 55640056k total,        0k used, 55640056k free,  5066724k cached
    

    I'm not sure why user usage is at 0% and the niced usage is all I see, but either way I'm looking for a way to get the usage up to 100%. Is there anyway to bolster the usage or is this the best I'm gonna get?

  • how to fix ffmpeg error 'frame crc mismatch'

    9 août 2013, par Sam

    I am trying to re-encode a video file using ffmpeg but every time I try to run it

    ffmpeg -i  -c:v libx264 -crf 25 -preset slow -c:a libfaac 
    

    it does the first five minutes or so of the video and then gives the following error and stops:

    frame CRC mismatch
    [matroska,webm @ 0x7ff609806600] Unknown entry 0x762F
    [matroska,webm @ 0x7ff609806600] Unknown entry 0x4B61
    [matroska,webm @ 0x7ff609806600] Unknown entry 0xA2
    [matroska,webm @ 0x7ff609806600] Unknown entry 0x7F38
    [matroska,webm @ 0x7ff609806600] Unknown entry 0x39E0B1
    frame= 7473 fps=8.3 q=30.0 size=   42488kB time=-577014:-32:-22.-77 bitrate=N/A 
    frame= 7473 fps=8.2 q=-1.0 Lsize=   43099kB time=00:05:12.06 bitrate=1131.4kbits/s    
    video:35549kB audio:7338kB subtitle:0 global headers:0kB muxing overhead 0.494802%
    [libx264 @ 0x7ff609826c00] frame I:70    Avg QP:21.35  size: 41968
    [libx264 @ 0x7ff609826c00] frame P:2000  Avg QP:24.37  size:  9139
    [libx264 @ 0x7ff609826c00] frame B:5403  Avg QP:26.21  size:  2811
    [libx264 @ 0x7ff609826c00] consecutive B-frames:  1.8%  2.7%  8.5% 87.1%
    [libx264 @ 0x7ff609826c00] mb I  I16..4: 25.7% 61.5% 12.8%
    [libx264 @ 0x7ff609826c00] mb P  I16..4:  5.3%  5.5%  0.5%  P16..4: 39.9%  6.3%  5.4%  0.0%  0.0%    skip:37.2%
    [libx264 @ 0x7ff609826c00] mb B  I16..4:  0.2%  0.4%  0.0%  B16..8: 36.6%  1.5%  0.2%  direct: 0.6%  skip:60.5%  L0:40.3% L1:58.3% BI: 1.3%
    [libx264 @ 0x7ff609826c00] 8x8 transform intra:52.6% inter:89.8%
    [libx264 @ 0x7ff609826c00] direct mvs  spatial:100.0% temporal:0.0%
    [libx264 @ 0x7ff609826c00] coded y,uvDC,uvAC intra: 38.4% 47.1% 8.5% inter: 6.5% 10.0% 0.0%
    [libx264 @ 0x7ff609826c00] i16 v,h,dc,p: 34% 18%  8% 39%
    [libx264 @ 0x7ff609826c00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11%  7% 10% 10% 14% 13% 13% 11% 11%
    [libx264 @ 0x7ff609826c00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 11%  6%  8% 13% 12% 12% 10% 12%
    [libx264 @ 0x7ff609826c00] i8c dc,h,v,p: 55% 21% 18%  6%
    [libx264 @ 0x7ff609826c00] Weighted P-Frames: Y:1.2% UV:0.9%
    [libx264 @ 0x7ff609826c00] ref P L0: 57.7% 10.2% 19.2%  5.9%  6.5%  0.5%  0.0%
    [libx264 @ 0x7ff609826c00] ref B L0: 82.1% 13.2%  3.6%  1.0%
    [libx264 @ 0x7ff609826c00] ref B L1: 94.8%  5.2%
    [libx264 @ 0x7ff609826c00] kb/s:934.32
    

    If I play the original video file in VLC, the frames at the point where the encoding stops go glitchy for a few seconds but then comes good again.

    How can I get around this? I don't really mind if those few seconds stay glitchy (although it would be nice if that could be fixed) but I do need to re-encode this video, with or without the glitchy couple of seconds...

    Even if I use another program like iFlicks to try and re-encode it does up to the same point and then stops. It also stops at the same point if I use ffmpeg to copy the codecs into a new mp4 container.

  • How to convert Live video stream from YUV(HDYC) to RGB

    9 août 2013, par user2499628

    I want to convert video streams from webcam. that video streams are called HDYC. I think it's a little special so I didn't control now.

    My question is How to convert that format to rgb in c++ using ffmpeg? but there are some constraints. I don't want to make a file. in other wors, It needs to convert video streams from webcam. also It's a real time operation.

    Thanks.

  • convert f4v to mp4 with ffmpeg

    9 août 2013, par Winnie Oldright

    Trying to convert f4v to mp4 with ffmpeg

    This file

    FFmpeg :

    ffmpeg -i input.f4v -vcodec copy -acodec copy output.mp4
    

    In output i have black screen in video and no sound but track seconds are incrementing properly.

    What i'm doing wrong? Or maybe i need mpg or some other file type in out put (output file type should supports in android).