Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Video recoding with ffmpeg

    8 novembre 2011, par Aleks G

    I asked in another question (http://stackoverflow.com/questions/8012494/sorry-this-video-cannot-be-played-streaming-mp4-to-android/8012874#8012874) about video playback in android using VideoView. Apparently, the problem there is due to the way my video is encoded, as another video (512Kb mp4 off the web) plays correctly using my code. As videos are uploaded by my end users to the web site, I don't have any control of the videos themselves, however I do have control over re-coding these. I re-code them using ffmpeg to bring them to a standard MP4 (H.264+AAC) format and scale them to the same size (320x240).

    Here's the ffmpeg info of a video that would not play:

    sh-3.2$ ffmpeg -i video.bad.mp4
    FFmpeg version SVN-r25679-snapshot, Copyright (c) 2000-2010 the FFmpeg developers
      built on Nov  5 2010 09:34:37 with gcc 4.3.2
      configuration: --prefix=/usr --enable-shared --enable-libmp3lame --enable-gpl --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-libgsm --enable-x11grab --enable-libx264 --enable-libtheora --extra-cflags=-Wall --enable-swscale --enable-libdc1394 --enable-nonfree --disable-mmx --disable-stripping --enable-avfilter --disable-altivec --disable-armv5te --disable-armv6 --disable-vis --enable-nonfree --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3
      libavutil     50.32. 6 / 50.32. 6
      libavcore      0.12. 0 /  0.12. 0
      libavcodec    52.94. 3 / 52.94. 3
      libavformat   52.84. 0 / 52.84. 0
      libavdevice   52. 2. 2 / 52. 2. 2
      libavfilter    1.56. 0 /  1.56. 0
      libswscale     0.12. 0 /  0.12. 0
      libpostproc   51. 2. 0 / 51. 2. 0
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.bad.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf52.84.0
      Duration: 00:00:45.93, start: 0.000000, bitrate: 591 kb/s
        Stream #0.0(und): Video: h264, yuv420p, 320x240 [PAR 1:1 DAR 4:3], 535 kb/s, 15 fps, 15 tbr, 15 tbn, 30 tbc
        Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 51 kb/s
    

    And here's the ffmpeg info of a video that plays correctly:

    sh-3.2$ ffmpeg -i video.mp4
    FFmpeg version SVN-r25679-snapshot, Copyright (c) 2000-2010 the FFmpeg developers
      built on Nov  5 2010 09:34:37 with gcc 4.3.2
      configuration: --prefix=/usr --enable-shared --enable-libmp3lame --enable-gpl --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-libgsm --enable-x11grab --enable-libx264 --enable-libtheora --extra-cflags=-Wall --enable-swscale --enable-libdc1394 --enable-nonfree --disable-mmx --disable-stripping --enable-avfilter --disable-altivec --disable-armv5te --disable-armv6 --disable-vis --enable-nonfree --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3
      libavutil     50.32. 6 / 50.32. 6
      libavcore      0.12. 0 /  0.12. 0
      libavcodec    52.94. 3 / 52.94. 3
      libavformat   52.84. 0 / 52.84. 0
      libavdevice   52. 2. 2 / 52. 2. 2
      libavfilter    1.56. 0 /  1.56. 0
      libswscale     0.12. 0 /  0.12. 0
      libpostproc   51. 2. 0 / 51. 2. 0
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: mp41
        title           : crazytown - http://www.archive.org/details/Cartoon-Crazytown
        encoder         : Lavf51.10.0
      Duration: 00:07:50.40, start: 0.000000, bitrate: 578 kb/s
        Stream #0.0(und): Video: h264, yuv420p, 320x240, 510 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
        Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 63 kb/s
    

    I have two questions here, actually. First, which of the details in my "bad" video does android not like? And, second, what parameters should I use with ffmpeg to recode my videos? As present I use this:

    ffmpeg -i $input_video_file -y -s 320x240 -vcodec libx264 -vpre medium -acodec libfaac -b 510K -ar 48000 -aspect 4:3 $tmpfile.mp4
    qt-faststart $tmpfile.mp4 $output_video_file.mp4
    

    But this produces a video that's not playable on android. Any help is greatly appreciated.

  • converting of wma to mp3 through ffmpeg is not working

    8 novembre 2011, par Rahul Mehta

    I want to convert my wma file to mp3 by ffmpeg . why this error is coming what should i do ? i installed libmp3lame already .

    when i am trying to convert by following command gives error :

    /var/www/yapi$ sudo /usr/local/bin/ffmpeg -i uploads/4e02dc4f197c1.wma uploads/4e02dc4f1b212.mp3
    ffmpeg version N-30971-g4b87a08, Copyright (c) 2000-2011 the FFmpeg developers
      built on Jun 23 2011 10:08:49 with gcc 4.4.5
      configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-x11grab
      libavutil    51.  9. 1 / 51.  9. 1
      libavcodec   53.  7. 0 / 53.  7. 0
      libavformat  53.  4. 0 / 53.  4. 0
      libavdevice  53.  1. 1 / 53.  1. 1
      libavfilter   2. 23. 0 /  2. 23. 0
      libswscale    2.  0. 0 /  2.  0. 0
      libpostproc  51.  2. 0 / 51.  2. 0
    Input #0, asf, from 'uploads/4e02dc4f197c1.wma':
      Metadata:
        title           : "Highway Blues"
        artist          : Marc Seales, composer. New Stories. Ernie Watts, saxophone.
        genre           : Jazz
        album           : Speakin' Out
        track           : 1
        WM/Year         : 1999
        WMFSDKVersion   : 8.00.00.4389
        WMFSDKNeeded    : 0.0.0.0000
      Duration: 00:01:33.71, start: 0.000000, bitrate: 64 kb/s
        Stream #0.0: Audio: wmav2, 44100 Hz, 2 channels, s16, 64 kb/s
    File 'uploads/4e02dc4f1b212.mp3' already exists. Overwrite ? [y/N] y
    
    Output #0, mp3, to 'uploads/4e02dc4f1b212.mp3':
        Stream #0.0: Audio: [0][0][0][0] / 0x0000, 44100 Hz, 2 channels, s16, 64 kb/s
    Stream mapping:
      Stream #0.0 -> #0.0
    Encoder (codec id 86017) not found for output stream #0.0
    

    why it is not working ?

  • What are the video streaming specifics : video coded parameters, web server configuration, video player ?

    8 novembre 2011, par albanx

    With my server I encode videos from any format to mp4 with ffmpeg, for making play them with flowplayer on the web site. The problem is that videos buffering is not working. Video plays once it has been fully buffered (downloaded).

    • Should mp4 videos be encoded in any particular way for having streaming work?
    • Or maybe the IIS7 server need extra configuration?
    • I am using php for getting video files: getMedia?file=asd.mp4

    I have IIS7 web server with php. Any suggestions?

  • “Hook” libMMS to FFmpeg for iPhone Streaming

    8 novembre 2011, par Xie Xingwei

    These days, I was researching the software architechture for iPhone Streaming (Base on MMS protocol).

    As we know, in order to playback MMS audio stream, we should call libMMS to read wma stream data from remote media server, and then call FFmpeg to decode the stream data from wma format into PCM data buffer, and finally, enqueue the PCM data buffer into iPhone’s audioqueue to generate real sound.

    The introduction above just describe the working process of iPhone streaming. If we only need to implement this simple functionality, that is not difficult. Just follow the introduction above to call libMMS, FFMpeg and audioqueue step by step, we can achieve the streaming function. Actually, I have implemented the code last week.

    But, what I need is not only a simple streaming function! I need a software architechture makes FFmpeg accessing libMMS just like accessing local filesystem!

    Does anybody know how to hook the libMMS interfaces like mms_read/mms_seek onto FFmpeg filesystem interfaces like av_read_frame/av_seek_frame?

  • FFmpeg static keyframe rate

    7 novembre 2011, par 2di

    I have a question about ffmpeg usage. Every time when I trying to convert video files into some different format, output file getting static keyframe sequence.

    What I mean is that keyframes appear at the distance of 12 frames. I know that its controllerd by parameter -g that you can change to any other number.

    ffmpeg -i 1.avi -vcodec mpeg4 -b 2000000  out.avi
    

    I believe there should be some way to make keyframes appear on uneven intervals. These interval should be calculated by codec, and it should be based on image changes in the video file. So keyframes should be inserted only when they needed, but not consistently after N frames.

    Can somebody please explain to me how this "smart" encoding can be done with ffmpeg ? Thank you

    SOLUTION: ok what I'ev been looking for has very simple solution. If you set -g to zero, ffmpeg will choose keyframes based on the video shots and bitrate