Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • adding silent audio in ffmpeg

    10 février 2017, par jon

    I'm trying to use ffmpeg to add a silent audio track to a MOV file.

    I created a silent audio track longer than the video, and intend to use the -shortest option with ffmpeg.

    Using SoX v14.3.1, I run this to generate a wav file:

    sox -n -r 44100 -b 16 -c 2 -L silence.wav trim 0.0 60.000
    
    # -n  = Sox's null file
    # -r = sample rate 
    # -b = bits per sample
    # -c = num of channels
    # -L = little endian
    # filename
    # trim - is an effect, args start and length.
    

    My basic ffmpeg command looks like this:

    ffmpeg -shortest \
    -i silence.wav -acodec pcm_s16le \
    -i vid_no_sound.mov -vcodec copy vid_with_sound.mov
    

    The result of this is:

    ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
      built on Aug 27 2012 13:11:25 with gcc 4.4.5
      configuration: --extra-cflags=-static --prefix=/root/ffmpeg_build/src/ffmpeg-0.11.1 --enable-bzlib --enable-gnutls --enable-libfreetype --enable-libmp3lame --enable-libdc1394 --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-openssl --enable-zlib --enable-gpl --enable-nonfree --enable-version3
      libavutil      51. 54.100 / 51. 54.100
      libavcodec     54. 23.100 / 54. 23.100
      libavformat    54.  6.100 / 54.  6.100
      libavdevice    54.  0.100 / 54.  0.100
      libavfilter     2. 77.100 /  2. 77.100
      libswscale      2.  1.100 /  2.  1.100
      libswresample   0. 15.100 /  0. 15.100
      libpostproc    52.  0.100 / 52.  0.100
    [wav @ 0x29ab2e0] max_analyze_duration 5000000 reached at 5015510
    Guessed Channel Layout for  Input Stream #0.0 : stereo
    Input #0, wav, from 'silence.wav':
      Duration: 00:01:00.00, bitrate: 1411 kb/s
        Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
    Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'vid_no_sound.mov':
      Metadata:
        major_brand     : qt
        minor_version   : 537199360
        compatible_brands: qt
        creation_time   : 2012-07-25 13:41:44
      Duration: 00:00:14.50, start: 0.000000, bitrate: 27457 kb/s
        Stream #1:0(eng): Video: qtrle (rle  / 0x20656C72), rgb24, 1920x1080, 27450 kb/s, SAR 1920:1920 DAR 16:9, 24 fps, 24 tbr, 24 tbn, 24 tbc
        Metadata:
          creation_time   : 2012-07-25 13:41:44
          handler_name    : Apple Alias Data Handler
        Stream #1:1(eng): Data: none (tmcd / 0x64636D74)
        Metadata:
          creation_time   : 2012-07-25 13:42:06
          handler_name    : Apple Alias Data Handler
          timecode        : 00:00:00:00
    File 'vid_with_sound.mov' already exists. Overwrite ? [y/N] y
    auto-inserting filter 'auto-inserted resampler 0' between the filter 'src' and the filter 'aformat'
    [aresample @ 0x2ab3b00] chl:stereo fmt:s16 r:44100Hz -> chl:stereo fmt:flt r:44100Hz
    [NULL @ 0x2994320] Codec is experimental but experimental codecs are not enabled, try -strict -2
    Output #0, mov, to 'vid_with_sound.mov':
        Stream #0:0(eng): Video: qtrle (rle  / 0x20656C72), rgb24, 1920x1080 [SAR 1920:1920 DAR 16:9], q=2-31, 27450 kb/s, 24 fps, 90k tbn, 24 tbc
        Metadata:
          creation_time   : 2012-07-25 13:41:44
          handler_name    : Apple Alias Data Handler
        Stream #0:1: Audio: none, 44100 Hz, stereo, flt, 128 kb/s
    Stream mapping:
      Stream #1:0 -> #0:0 (copy)
      Stream #0:0 -> #0:1 (pcm_s16le -> aac)
    Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
    

    I have tried adding the -strict -2 as suggested, although I am not sure where to put it in the command line.

    I've spent two hours trying different things and reading ffmpeg documentation, but I'm still stuck.

    How do I add a silent audio track to a mov file?

  • FFMpeg adding silence : struggling to use -i anullsrc option [duplicate]

    9 février 2017, par Kod4krome

    This question already has an answer here:

    I am just trying to add a silent audio track to a video file using ffmpeg:

    ffmpeg.exe -i video.mkv -i anullsrc -c:v copy -c:a aac -shortest test.mkv
    

    I have ffmpeg precompiled release for windows 64bit (20170208)

    Whenever I run I get this error:

    anullsrc: No such file or directory
    

    Thanks for any help.

  • how to make ffmpeg output frames at correct rate down to millisecond

    9 février 2017, par Pavel K.

    using ffmpeg, i am fetching frames from udp stream (hd264 at 25 fps) using following command:

    ffmpeg -loglevel debug -i udp://231.20.20.146:2005 -fflags nobuffer -r 1 -preset ultrafast -vf scale=432:243 -f image2pipe -vcodec ppm pipe:1

    at the other end of the pipe i am running a very simple binary which outputs the time at which it receives a frame.

    however, even though i specify fps 1, frames enter the pipe with some delay, with 100-200ms delay.

    what causes this delay? is it the decoding of the frames and encoding of ppm image? and how can i force ffmpeg to send images at least at the correct distance between each other, so that each frame would arrive exactly 1000ms after previous frame?

    ps. the first 6 frames are buffered and enter the pipe almost at once. here is an example of recorded ms values :

    5350 5368 5385 5493 5599 5676 5785 6221 7243 8235 9218 10219 11227 12268 13268 14242 15288 16219 17297 18222 19284 20272

  • C# ffmpeg editor [on hold]

    9 février 2017, par John Work

    Would you tell C# Ffmpeg how to edit the video and how to add the time?

  • MediaPlayer doesn't play second audio track in HLS

    9 février 2017, par Yehor Nemov

    Does anybody know how properly play (via Android MediaPlayer) or convert media file with 1 video track and 2 audio tracks to enable 2nd audio playback?

    Conversion is done with FFMPEG utility:

    ffmpeg -i sample.mp4 -map 0:0 -map 0:1 -map 0:2 \
        -vcodec h264 -acodec:0 aac -acodec:1 aac \
        -strict -2 -f hls -hls_list_size 0 sample.m3u8
    

    P.S. Media conversion is checked manually with VLC media player (audio tracks are presented and available to be switched).