Recherche avancée

Médias (91)

Sur d’autres sites (74)

  • How to stop a sound when certain other sound is inserted in the mix in ffmpeg ?

    3 avril 2022, par Antonio Oliveira

    I'm using a ffmpeg command that takes a set of sounds, mixes them into a single file, separating them by certain time intervals.

    


    Below is how my command is today.

    


    ffmpeg -i 
close_hh.wav    -i \
crash_l.wav     -i \
crash_r.wav     -i \
floor.wav       -i \
kick_l.wav      -i \
kick_r.wav      -i \
open_hh.wav     -i \
ride.wav        -i \
snare.wav       -i \
splash.wav      -i \
tom_1.wav       -i \
tom_2.wav       -i \
  tom_3.wav  -filter_complex  " [6]adelay=0|0[note_0];  [0]adelay=360|360[note_1];  [6]adelay=1260|1260[note_2];  [0]adelay=1537|1537[note_3];  [6]adelay=2494|2494[note_4];  [5]adelay=2767|2767[note_5];  [0]adelay=2969|2969[note_6];  [6]adelay=3673|3673[note_7];  [5]adelay=3924|3924[note_8];  [0]adelay=4132|4132[note_9];  [0][note_0][note_1][note_2][note_3][note_4][note_5][note_6][note_7][note_8][note_9]amix=inputs=11:normalize=0" record.wav


    


    This is the resulting audio that this command generates :

    


    ffmpg record.wav : https://drive.google.com/file/d/1LFV4ImLKLnRCqZRhZ7OqZy4Ecq5fwT3j/view?usp=sharing

    


    The purpose is to generate a drum recording, so I would like to simulate the dynamics of the hi-hat sounds : When the closed hi-hat is played, the open hi-hat will stop playing immediately if it is still sounding. The same behavior does not happen for any of the other sounds.

    


    One point that makes this a little more challenging is that other sounds can also be played between open hi-hat and closed hi-hat strikes, and theoretically the sound interruption behavior should work normally.

    


    Below is a recording demonstrating the expected result. (My app already reproduces the sound result I need internally, so I just made a simple recording with the microphone to illustrate)

    


    mic record.wav https://drive.google.com/file/d/19x19Fd_URQVo-MMCmGEHIC1SjaQbpWrh/view?usp=sharing

    


    Notice that in the first audio (ffmpeg record.wav) the first sound (open hi-hat) continues playing after the second is played.
In the second audio (mic record.wav) the first sound stops immediately after the second sound is played.

    


    How should the ffmpeg command be to get the expected result ?

    


  • Problems writing to pipe in ffmpeg

    28 juin 2018, par Mikkel Bachmann

    I have written a stream server that utilizes FFMPEG for transcoding. [StreamServer2 v.1.5]

    The way it works is that i have thru a control channel tell a DVR to open a stream, when the stream is open the DVR will respond with a sdp file- or the info for the sdp file.
    This is working when i run StreamServer2 on my windows 10 computer, byt when i run it on my 2016 server, i get an error saying : Output file #0 does not contain any stream

    I works on my Windows 10 computer, also I have an old version of StreamServer2 from before we created the control channel ; that one is opning a RTSP stream as you normally will do, bu calling the rtsp url, and that is currently running live on an server 2008R2 environment.

    The reason that we did change the way of getting a stream is that we have a new system where the DVRs IPAddress is dynamic and unpredictable.

    So i hope that somebody can help me find out why it does not work on Windows Server 2016

    The FFMPG Report file

    ffmpeg started on 2018-06-27 at 13:06:51
    Report written to "ffmpeg-20180627-130651.log"
    Command line:
    "E:\\r2pPrograms\\StreamServer2\\ffmpeg.exe" -stdin -y -loglevel info -report -protocol_whitelist file,udp,rtp -i 8936021605650268160_37.sdp -f mpeg1video -g 52 -movflags frag_keyframe+empty_moov -b:v 64k -q 5 -an -
    ffmpeg version N-91024-g293a6e8332 Copyright (c) 2000-2018 the FFmpeg developers
     built with gcc 7.3.0 (GCC)
     configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
     libavutil      56. 18.100 / 56. 18.100
     libavcodec     58. 19.101 / 58. 19.101
     libavformat    58. 13.102 / 58. 13.102
     libavdevice    58.  4.100 / 58.  4.100
     libavfilter     7. 21.100 /  7. 21.100
     libswscale      5.  2.100 /  5.  2.100
     libswresample   3.  2.100 /  3.  2.100
     libpostproc    55.  2.100 / 55.  2.100
    Splitting the commandline.
    Reading option '-stdin' ... matched as option 'stdin' (enable or disable interaction on standard input) with argument '1'.
    Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
    Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'info'.
    Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
    Reading option '-protocol_whitelist' ... matched as AVOption 'protocol_whitelist' with argument 'file,udp,rtp'.
    Reading option '-i' ... matched as input url with argument '8936021605650268160_37.sdp'.
    Reading option '-f' ... matched as option 'f' (force format) with argument 'mpeg1video'.
    Reading option '-g' ... matched as AVOption 'g' with argument '52'.
    Reading option '-movflags' ... matched as AVOption 'movflags' with argument 'frag_keyframe+empty_moov'.
    Reading option '-b:v' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '64k'.
    Reading option '-q' ... matched as option 'q' (use fixed quality scale (VBR)) with argument '5'.
    Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'.
    Reading option '-' ... matched as output url.
    Finished splitting the commandline.
    Parsing a group of options: global .
    Applying option stdin (enable or disable interaction on standard input) with argument 1.
    Applying option y (overwrite output files) with argument 1.
    Applying option loglevel (set logging level) with argument info.
    Applying option report (generate a report) with argument 1.
    Successfully parsed a group of options.
    Parsing a group of options: input url 8936021605650268160_37.sdp.
    Successfully parsed a group of options.
    Opening an input file: 8936021605650268160_37.sdp.
    [NULL @ 000001484256c1c0] Opening '8936021605650268160_37.sdp' for reading
    [sdp @ 000001484256c1c0] Format sdp probed with size=2048 and score=50
    [sdp @ 000001484256c1c0] video codec set to: h264
    [udp @ 0000014842572700] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
    [udp @ 0000014842572700] end receive buffer size reported is 65536
    [udp @ 000001484258f140] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
    [udp @ 000001484258f140] end receive buffer size reported is 65536
    [sdp @ 000001484256c1c0] setting jitter buffer size to 500
    [sdp @ 000001484256c1c0] Before avformat_find_stream_info() pos: 152 bytes read:152 seeks:0 nb_streams:1
    [sdp @ 000001484256c1c0] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    [sdp @ 000001484256c1c0] After avformat_find_stream_info() pos: 152 bytes read:152 seeks:0 frames:0
    Input #0, sdp, from '8936021605650268160_37.sdp':
     Duration: N/A, bitrate: N/A
       Stream #0:0, 0, 1/90000: Video: h264, none, 90k tbr, 90k tbn, 180k tbc
    Successfully opened the file.
    Parsing a group of options: output url -.
    Applying option f (force format) with argument mpeg1video.
    Applying option b:v (video bitrate (please use -b:v)) with argument 64k.
    Applying option q (use fixed quality scale (VBR)) with argument 5.
    Applying option an (disable audio) with argument 1.
    Successfully parsed a group of options.
    Opening an output file: -.
    Output #0, mpeg1video, to 'pipe:':
    Output file #0 does not contain any stream
    [AVIOContext @ 0000014842574b80] Statistics: 152 bytes read, 0 seeks