Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • FFMPEG Runs OK locally but fails when run on Heroku server

    9 mars 2017, par Berni

    I'm working on a project which takes a video and converts it to a sprite sheet image.

    When I run the app locally using npm start the video uploads and the sprite sheet is generated.

    However when I deploy the app to Heroku and perform the same actions I get the following errors from the Heroku log:

    2017-03-09T16:03:43.069886+00:00 app[web.1]: error: ffmpeg exited with code 1: Error while opening encoder for output stream #23:0 - maybe incorrect parameters such as bit_rate, rate, width or height
    
    2017-03-09T16:03:43.069897+00:00 app[web.1]: 
    2017-03-09T16:03:43.069922+00:00 app[web.1]: stdout: 
    
    2017-03-09T16:03:43.069989+00:00 app[web.1]: stderr:   split:output4 (graph 0) -> Stream #5:0 (png)
    
    2017-03-09T16:03:43.070083+00:00 app[web.1]: Error while opening encoder for output stream #23:0 - maybe incorrect parameters such as bit_rate, rate, width or height
    

    I've checked that the bit_rate, rate, width and height are all correctly set.

    Any advice on how to get this resolved would be appreciated :)

  • Can you put the result of a blackdetect filter in a textfile using ffmpeg ?

    9 mars 2017, par Gijserman

    I'm testing out the "blackdetect" filter in ffmpeg. I want to have the times when the video is black to be read by a script (like actionscript or javascript). I tried:

    ffmpeg -i video1.mp4 -vf "blackdetect=d=2:pix_th=0.00" -an -f null -
    

    And I get a nice result in the ffmpeg log:

    ffmpeg version N-55644-g68b63a3 Copyright (c) 2000-2013 the FFmpeg developers
      built on Aug 19 2013 20:32:00 with gcc 4.7.3 (GCC)
      configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
    le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
    e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
    ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
    ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
    eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-
    amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --
    enable-libxvid --enable-zlib
      libavutil      52. 42.100 / 52. 42.100
      libavcodec     55. 28.100 / 55. 28.100
      libavformat    55. 13.103 / 55. 13.103
      libavdevice    55.  3.100 / 55.  3.100
      libavfilter     3. 82.100 /  3. 82.100
      libswscale      2.  5.100 /  2.  5.100
      libswresample   0. 17.103 /  0. 17.103
      libpostproc    52.  3.100 / 52.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video1.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        creation_time   : 1970-01-01 00:00:00
        encoder         : Lavf53.13.0
      Duration: 00:02:01.54, start: 0.000000, bitrate: 275 kb/s
        Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 768x432 [
    SAR 1:1 DAR 16:9], 211 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
        Metadata:
          creation_time   : 1970-01-01 00:00:00
          handler_name    : VideoHandler
        Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 59
     kb/s
        Metadata:
          creation_time   : 1970-01-01 00:00:00
          handler_name    : SoundHandler
    Output #0, null, to 'pipe:':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf55.13.103
        Stream #0:0(eng): Video: rawvideo (I420 / 0x30323449), yuv420p, 768x432 [SAR
     1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 25 tbc
        Metadata:
          creation_time   : 1970-01-01 00:00:00
          handler_name    : VideoHandler
    Stream mapping:
      Stream #0:0 -> #0:0 (h264 -> rawvideo)
    Press [q] to stop, [?] for help
    [null @ 00000000003279a0] Encoder did not produce proper pts, making some up.
    [blackdetect @ 0000000004d5e800] black_start:0 black_end:17.08 black_duration:17
    .08
    [blackdetect @ 0000000004d5e800] black_start:62.32 black_end:121.48 black_durati
    on:59.16
    frame= 3038 fps=2317 q=0.0 Lsize=N/A time=00:02:01.52 bitrate=N/A
    video:285kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.007543%
    

    And I'm particularly interested in this part:

    [blackdetect @ 0000000004e2e340] black_start:0 black_end:17.08 black_duration:17.08
    [blackdetect @ 0000000004e2e340] black_start:62.32 black_end:121.48 black_duration:59.16
    

    So my question:

    1. Is there a way to only take the blackdetect filter output and put it in a .txt file?
    2. And if this is possible, is there a way to do this in a statement with multiple video inputs? Like in this example

    example:

    ffmpeg -f concat -i mylist.txt -c copy concat.mp4
    

    Where mylist.txt is a list of videos:

    file 'video1.mp4'
    file 'video2.mp4'
    file 'video3.mp4'
    file 'video4.mp4'
    

    Basically what I want to have is one or more text files containing information about the black frames in every video in this list to be used by another program

  • How to concatenate videos and adding background audio by using FFMPEG library

    9 mars 2017, par Furqan

    I am very new to FFMPEG library and i want some directions to implement a program that receives an list of videos (mp4 format) and audio file (mp3 ) and concatenate them with timestamps and remove its audio and add given audio and output a final video.

    Thanks

  • Concatenate two mp4 files using ffmpeg

    9 mars 2017, par Mark L

    I'm trying to concatenate two mp4 files using ffmpeg. I need this to be an automatic process hence why I chose ffmpeg. I'm converting the two files into .ts files and then concatenating them and then trying to encode that concated .ts file. The files are h264 and aac encoded and I'm hoping to keep the quality the same or as close to original as possible.

    ffmpeg -i part1.mp4 -vcodec copy -vbsf h264_mp4toannexb -acodec copy part1.ts
    ffmpeg -i part2.mp4 -vcodec copy -vbsf h264_mp4toannexb -acodec copy part2.ts
    cat part1.ts part2.ts > parts.ts
    ffmpeg -y -i parts.ts -acodec copy -ar 44100 -ab 96k -coder ac -vbsf h264_mp4toannexb parts.mp4
    

    Unfortunately I'm getting the following error message coming back from ffmpeg during encoding:

    [h264 @ 0x1012600]sps_id out of range
    [h264 @ 0x1012600]non-existing SPS 0 referenced in buffering period
    [h264 @ 0x1012600]sps_id out of range
    [h264 @ 0x1012600]non-existing SPS 0 referenced in buffering period
    [NULL @ 0x101d600]error, non monotone timestamps 13779431 >= 13779431kbits/s    
    av_interleaved_write_frame(): Error while opening file
    

    This happens about half way through encoding which makes me think that you can't concat two .ts files together and have it work. Any help would be much appreciated.

  • Inserting an image inside a video every few frames using ffmpeg

    9 mars 2017, par Erez Hochman

    Can I use FFMPEG to insert an image every 20 frames in a video? I'm trying to create a subliminal message experiment and I thought it would be an easy way to make it but I can't find anything online.

    I tried to make something myself and created a script that:
    1.splits a file into audio and video files
    2.splits the video into frames
    3.overwrites every 20th image in the sequence with the message image
    4.re-encoding the video
    5.concatenating it with the original audio

    this works but it's way more disk space consuming to be comfortable, is there a better way to do this?
    any advice or thought would be happily welcome.