Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • FFmpeg : merge 8 mono audio streams MOV file into one audio stream FLV file

    1er décembre 2015, par snucky

    I have a MOV file with eight mono audio streams, likely a 5.1 or 7.1 setup. I want to generate a for-web preview FLV file from it but in doing so lose the voices in the dialogue. FFmpeg is likely favoring an audio stream out of the eight that doesn't have the voices. When I researched ways to merge the audio streams, in order to bring the voices back, I lose the ability to execute my ffmpeg command entirely. Here's what I have at the moment (the introduction of the "-map 0" option rendered the command non-executable)

    /usr/local/bin/ffmpeg -i ../vmx_files/6711177.mov -map 0 -y -f flv -qmax 10
          -vf "scale=trunc(oh*a/2)*2:720" -ar 44100 -ab 64k assets/flv/6711177.flv
    
    
    ffmpeg version N-69160-g1013c15 Copyright (c) 2000-2015 the FFmpeg developers
      built on Jan 20 2015 09:41:10 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-11)
      configuration:
      libavutil      54. 17.100 / 54. 17.100
      libavcodec     56. 20.100 / 56. 20.100
      libavformat    56. 19.100 / 56. 19.100
      libavdevice    56.  4.100 / 56.  4.100
      libavfilter     5.  8.100 /  5.  8.100
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  1.100 /  1.  1.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../vmx_files/6711177.mov':
      Metadata:
        major_brand     : qt
        minor_version   : 537199360
        compatible_brands: qt
        creation_time   : 2015-11-24 23:00:27
      Duration: 00:01:48.34, start: 0.000000, bitrate: 229443 kb/s
        Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le(bt709), 1920x1080, 220043 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 2997 tbn, 2997 tbc (default)
        Metadata:
          creation_time   : 2015-11-24 23:00:27
          handler_name    : Apple Alias Data Handler
          encoder         : Apple ProRes 422 (HQ)
          timecode        : 00:59:50;00
        Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
        Metadata:
          creation_time   : 2015-11-24 23:00:27
          handler_name    : Apple Alias Data Handler
        Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
        Metadata:
          creation_time   : 2015-11-24 23:00:27
          handler_name    : Apple Alias Data Handler
        Stream #0:3(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
        Metadata:
          creation_time   : 2015-11-24 23:00:27
          handler_name    : Apple Alias Data Handler
        Stream #0:4(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
        Metadata:
          creation_time   : 2015-11-24 23:00:27
          handler_name    : Apple Alias Data Handler
        Stream #0:5(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
        Metadata:
          creation_time   : 2015-11-24 23:00:27
          handler_name    : Apple Alias Data Handler
        Stream #0:6(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
        Metadata:
          creation_time   : 2015-11-24 23:00:27
          handler_name    : Apple Alias Data Handler
        Stream #0:7(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
        Metadata:
          creation_time   : 2015-11-24 23:00:27
          handler_name    : Apple Alias Data Handler
        Stream #0:8(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
        Metadata:
          creation_time   : 2015-11-24 23:00:28
          handler_name    : Apple Alias Data Handler
        Stream #0:9(eng): Data: none (tmcd / 0x64636D74)
        Metadata:
          rotate          : -0
          creation_time   : 2015-11-24 23:03:22
          handler_name    : Apple Alias Data Handler
          timecode        : 00:59:50;00
    Data stream encoding not supported yet (only streamcopy)
    
  • Convert .avi to .gif with ffmpeg with good quality AND subtitles

    1er décembre 2015, par Stergios Marias

    I want to use ffmpeg to convert .avi to .gif with good quality and subtitles.

    Now, I use this script to convert from .avi to .gif with good quality:

    ffmpeg -v warning -ss 10:00 -t 5 -i input.avi -vf "fps=15,scale=420:-1:flags=lanczos,palettegen" -y palette.png
    ffmpeg -v warning -ss 10:00 -t 5 -i input.avi -i palette.png -lavfi "fps=15,scale=420:-1:flags=lanczos [x]; [x][1:v] paletteuse" -y output.gif
    

    I generate a palette and then using it to output the gif.

    Then I am using this script to add subtitles to gif:

    ffmpeg -v warning -i output.gif -vf "ass=subtitles.ass" -y outputWithSubs.gif
    

    All that works just fine. The problem is that the first script gives me good quality without subtitles and the second gives me subtitles without good quality.

    When I am trying to combine them with this script:

    ffmpeg -v warning -ss 10:00 -t 5 -i input.avi -vf "fps=15,scale=420:-1:flags=lanczos,palettegen" -y palette.png
    ffmpeg -v warning -ss 10:00 -t 5 -i input.avi -i palette.png -vf "ass=subtitles.ass" -lavfi "fps=15,scale=420:-1:flags=lanczos [x]; [x][1:v] paletteuse" -y output.gif
    

    I am getting this error:

    Filtergraph 'ass=subtitles.ass' was specified through the -vf/-af/-filter option for output stream 0:0, which is fed from a complex filtergraph. -vf/-af/-filter and -filter_complex cannot be used together for the same stream.

    Is there any way that I could combine good quality and subtitles at the same time?

  • Why is live video stream not fluent while audio stream is normal when they are played by Flash RTMP Player after being encoded

    1er décembre 2015, par xiaolan

    My video stream is encoded with H.264, and audio stream is encoded with AAC. In fact, I get these streams by reading a file whose format is flv. I only decode video stream in order to get all video frames, then I do something by using ffmpeg before encoding them, such as change some pixels. At last I will push the video and audio stream to Crtmpserver. When I pull the live stream from this server, I find the video is not fluent but audio is normal. But when I change gop_size from 12 to 3, everything is OK. What reasons cause that problem, can anyone explain something to me?

  • How to avoid mouse pointer flicker when capture a window by FFmpeg ?

    1er décembre 2015, par Mitra M

    I used gdigrab for capture a window. it works well, But the mouse pointer blinks. (Especially when the window size is large)

    My commands (c#):

     Process FFProc= new Process();
     FFProc.StartInfo.FileName = "cmd.exe";
     FFProc.StartInfo.Arguments="/C ffmpeg -y -f gdigrab -framerate 25 -i title=\"MyWin\" out.mpg";
     FFProc.Start();
    

    or (c++):

     system("ffmpeg -y -f gdigrab -framerate 25 -i title=\"MyWin\" out.mpg");
    

    Please tell me How to avoid mouse pointer flicker when capture a window by FFmpeg?

    FFmpeg = latest Zeranoe build

    OS = MS Windows 8.1

  • How to decode an h264 byte stream on iOS 6+ ?

    1er décembre 2015, par sadhi

    I am working on an iOS app to display a h264 video stream with aac audio.
    The stream I have is a custom stream that does not use HLS or rtsp/rtmp, so I have my own code to handle the receiving of data.
    The data I receive is in two parts: header data and frame data (for both audio and video). I would like to support iOS6+, but will adept if necessary.

    My initial idea was converting my frame data from a byte array to an UIImage and than continuously update a UIImageView with new frames. The problem with this is that the frames still need to be decoded first.

    I looked at ffmpeg, but all the examples I have seen need either an URL or a local file which don’t work for me. And I read that there might be some licensing problems when using ffmpeg.

    I also looked at openh264. I think that might be an option, but since I am developing for iOS, I will still run into those licensing issues.

    Edit:
    I managed to get this implemented on iOS 8+ using videoToolbox and the provided sample. My problem with that was I was receiving more data from my stream, than in the example.

    I am still looking for a way to do this on iOS 6 and 7.

    So my question is how should I handle the decoding and displaying of my frames?