[FFmpeg-user] FFmpeg amerge with itsoffset on only one audio stream

Stefano Sabatini stefasab at gmail.com
Thu Sep 12 09:46:16 CEST 2013


On date Wednesday 2013-09-11 19:22:43 +0000, Paulo Miguel Almeida Rodenas wrote:
[...]
> Unfortunately when I audio merge one audio stream ( probably the
> user's one) the conversation goes a little bit awkward like below:
> 
> Expected Scenario:
> 
>   *   User: Hi, How are you ?
>   *   Seller: I'm good thanks, How can I help you ?
>   *   User: I'd like to know a little more about the product next to you
>   *   Seller: Sure, Which information would you like to know?
>   *   User: How much does it cost?
>   *   Seller: It's 100 bucks
> 
> Actual Scenario:
> 
>   *   User: Hi, How are you ?
>   *   User: I'd like to know a little more about the product next to you
>   *   Seller: I'm good thanks, How can I help you ?
>   *   User: How much does it cost?
>   *   Seller: Sure, Which information would you like to know?
>   *   Seller: It's 100 bucks
> 
> It seems like one stream comes much faster than another so when I
> merge the audio the conversation makes no sense for the spectator. I
> tried to use in some many ways the itsoffset parameters but with no
> success
> 
> Do you guys got any idea of how can I get that working ? I mean, is
> there anything I can do to postpone the fast stream to make the
> conversation closer to the expected?
> 
> This is the last ffmpeg commando I'm using.
> 
> ffmpeg -itsoffset 00:00:07 -i rtmp://<ip>:1935/live/micMyStream1 -i
> rtmp://<ip>:1935/live/MyStream1 -filter_complex [0:a][1:a]amerge
> -codec:a aac -ac 2 -strict -2 -f flv
> rtmp://<ip>:1935/live/bcMyStream1

Check the audio stream timestamps (ffprobe -show_entries
packet=pts_time -select_streams a -of compact), I bet there is silence
detection and cancellation, so you get non-continuous timestamps and
these befuddle the amerge filter. You probably need to employ an
aresample filter in order to fill the audio gaps, and get a continuous
stream. Check man ffmpeg-resampler(1), relevant options are:
 first_pts
 min_comp
 min_hard_comp
 comp_duration
 max_soft_comp

If you can't figure out the meaning of the options, ask on this
mailing list and someone might be able to help.


More information about the ffmpeg-user mailing list