Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • how to mp3 to mp4 ffmpeg with mp3 tag display ?

    31 juillet 2017, par Tunna Bulutlu

    I added lyrics to my mp3 with tag edit. But now, I want to convert from mp3 to mp4 but the lyrics should be on the screen again.

    My question is, how would I do this?.

  • Can't find ffmpeg.exe [on hold]

    31 juillet 2017, par Eldar Azulay

    I want to use ffmpeg for my c# program, so I downloaded it from their website here: https://www.ffmpeg.org/download.html by clicking on the big green button, but in this archive there's no exe, which I need to run so I can use it. This is that I see when opening the file I downloaded: enter image description here

    I just want to know how can I get the ffmpeg.exe file.

  • fluent-ffmpeg from an array of input files

    30 juillet 2017, par leonard vertighel

    I want to use fluent-ffmpeg to create a video of last n images of a directory, or database entries.

    Which is the correct syntax?

    These are my tries:

    Mimic shell command

    ffmpeg()
      .addInput('ls *png | tail -n 17')
      .inputOptions("-pattern_type glob")
      .output("output.mp4").run()
    

    but it does not accept shell commands;

    space - separated paths

    ffmpeg()
      .addInput('a*.png b*.png ')
      .inputOptions("-pattern_type glob")
      .output("output.mp4").run()
    

    but it does not accept list of files separated by spaces;

    Array of image paths

    ffmpeg()
      .addInput(array) // ['aa.png', 'a1.png',,,'bbb.png']
      .inputOptions("-pattern_type glob")
      .output("output.mp4").run()
    

    but it does not accept arrays.

    EDIT:

    Also, from Merge Multiple Videos using node fluent ffmpeg, I am able to add multiple inputs using an array of files as

    var ffmpeg= require('fluent-ffmpeg');
    var f=ffmpeg() 
    pngarr.forEach(p => f.input(p)) /// pngarr is my array of png paths
    

    But running

    f.output("./output.mp4").run()
    

    I obtain just a video of 0 seconds containing the first png of the list.

  • Merge videos with different Frame Rates using MP4Parser

    30 juillet 2017, par BorisB

    I am currently successful at using MP4Parser library (https://github.com/sannies/mp4parser) to merge two videos created by my phones camera with same frame rates and resolutions. However when I try to merge one I encode via Android MediaCodec with the same resolution and same codec to the one recorded via the phones camera it produces an unplayable file with no errors.

    The only difference between the two files that I can see is the Camera file has frame rates of this:

    Frame rate mode : Variable
    Frame rate : 29.970 (29970/1000) FPS
    Minimum frame rate : 29.831 FPS
    Maximum frame rate : 30.030 FPS

    and the one I generate via Media Codec has this:

    Frame rate mode : Constant
    Frame rate : 30.000 FPS

    MP4 parser documentation says: 'It is important to emphasize that you cannot append any two tracks with: Different resolutions or Different frame-rates'

    So yeah I guess I'm out of luck with that solution.

    Now the only two others solutions I have come across are FFMPEG (which I don't want to bother with because of licensing issues) and using Mediacodec to first decoded and then encode the video files together.

    Is using Mediacodec basically the most sound approach here? Will there be problems when I need to add audio into the mix later on? Most importantly does anyone have a good examples of doing this type of merge?

    I know http://bigflake.com/mediacodec/ is the best source for these types of examples but I can't really see anything there that does exactly this. Any help would be greatly appreciated.

  • ffmpeg : specify/force pixel format for input H.264 video

    30 juillet 2017, par AndreG

    I have some MP4 video files missing the pixel format in their header information. I have already tried setting probesize and analyzeduration to their maximum values 2147483647 but that didn't help.

    So I know these videos are probably corrupt but if this is the only information missing I was thinking I could maybe recover them by rebuilding their header information or somehow decoding them by forcing a pixel format. Does anyone have any idea if this is possible? Some more background on the file:

    Mediainfo:

    $ mediainfo DJI_0090.MOV 
    General
    Complete name                            : DJI_0090.MOV
    Format                                   : MPEG-4
    Format profile                           : QuickTime
    Codec ID                                 : qt   2014.02 (qt  )
    File size                                : 165 MiB
    Duration                                 : 22 s 322 ms
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 61.8 Mb/s
    Encoded date                             : UTC 2017-05-31 18:04:45
    Tagged date                              : UTC 2017-05-31 18:04:45
    Comment                                  : 0.9.145
    ©gpt                                     : -170.60
    ©gyw                                     : +157.30
    ©grl                                     : +0.00
    IsTruncated                              : Yes
    
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L4.2
    Format settings, CABAC                   : Yes
    Format settings, RefFrames               : 1 frame
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 22 s 322 ms
    Bit rate mode                            : Variable
    Bit rate                                 : 59.4 Mb/s
    Maximum bit rate                         : 50.0 Mb/s
    Width                                    : 1 920 pixels
    Height                                   : 1 080 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Constant
    Frame rate                               : 59.940 (60000/1001) FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.478
    Stream size                              : 158 MiB (96%)
    Title                                    : DJI.AVC
    Language                                 : English
    Encoded date                             : UTC 2017-05-31 18:04:45
    Tagged date                              : UTC 2017-05-31 18:04:45
    Color range                              : Limited
    Color primaries                          : BT.709
    Transfer characteristics                 : BT.709
    Matrix coefficients                      : BT.709
    

    ffprobe:

    $ ffprobe -analyzeduration 2147483647 -probesize 2147483647 DJI_0090.MOV 
    ffprobe version 3.3.2 Copyright (c) 2007-2017 the FFmpeg developers
      built with Apple LLVM version 8.1.0 (clang-802.0.42)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables     --enable-avresample --cc=clang --host-cflags= --host-ldflags= --disable-indev=qtkit --enable-ffplay --enable-libfdk-aac --enable-libmp3lame     --enable-libsoxr --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-opencl --disable-lzma     --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.1.2_1/include/openjpeg-2.1 --enable-nonfree     --enable-vda
      libavutil      55. 58.100 / 55. 58.100
      libavcodec     57. 89.100 / 57. 89.100
      libavformat    57. 71.100 / 57. 71.100
      libavdevice    57.  6.100 / 57.  6.100
      libavfilter     6. 82.100 /  6. 82.100
      libavresample   3.  5.  0 /  3.  5.  0
      libswscale      4.  6.100 /  4.  6.100
      libswresample   2.  7.100 /  2.  7.100
      libpostproc    54.  5.100 / 54.  5.100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc2e9002600] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1920x1080):     unspecified pixel format
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'DJI_0090.MOV':
      Metadata:
        major_brand     : qt  
        minor_version   : 538182144
        compatible_brands: qt  
        creation_time   : 2017-05-31T18:04:45.000000Z
        comment         : 0.9.145
      Duration: 00:00:22.36, bitrate: 61732 kb/s
        Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none, 1920x1080, 59.94 fps, 59.94 tbr, 60k tbn, 120k tbc (default)
        Metadata:
          creation_time   : 2017-05-31T18:04:45.000000Z
          handler_name    : DJI.AVC
          encoder         : Dji AVC encoder
    

    I can't force the pixel_format on ffmpeg this way:

    $ ffmpeg -pixel_format yuv420p -i DJI_0090.MOV test.mp4
    ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
      built with Apple LLVM version 8.1.0 (clang-802.0.42)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables     --enable-avresample --cc=clang --host-cflags= --host-ldflags= --disable-indev=qtkit --enable-ffplay --enable-libfdk-aac --enable-libmp3lame     --enable-libsoxr --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-opencl --disable-lzma     --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.1.2_1/include/openjpeg-2.1 --enable-nonfree     --enable-vda
      libavutil      55. 58.100 / 55. 58.100
      libavcodec     57. 89.100 / 57. 89.100
      libavformat    57. 71.100 / 57. 71.100
      libavdevice    57.  6.100 / 57.  6.100
      libavfilter     6. 82.100 /  6. 82.100
      libavresample   3.  5.  0 /  3.  5.  0
      libswscale      4.  6.100 /  4.  6.100
      libswresample   2.  7.100 /  2.  7.100
      libpostproc    54.  5.100 / 54.  5.100
    Option pixel_format not found.
    

    Is there any other way to accomplish this with ffmpeg? Is it possible to edit their header information to include the pixel format information?