[FFmpeg-user] overlay with video offset not starting audio with same offset

Chad Horton chorton at hotsalsainteractive.com
Mon Aug 31 17:35:18 CEST 2015


I ended up taking this route.  Worked like a charm.

Create [s1]: aevalsrc=0:d=N[s1], where N is the number of seconds (to
match video offset (itsoffset))
Concat [s1] and overlayvideo¹s audio (where [s1] is placed before [1:a]):
[s1][1:a]concat=n=2:v=0:a=1[ovrla].
Amix audio from basevideo ([0:a]) with [ovrla]

Ffmpeg -y -i basevideo.mp4 -itsoffset 4 -i overlayvideo.mov
-filter_complex 
"aevalsrc=0:d=4[s1];[s1][1:a]concat=n=2:v=0:a=1[ovrla];[1:v]scale=1280:720[
ovrl];[0:v][ovrl]overlay=eof_action=pass[outv];[0:a][ovrla]amix[outa]"
-map [outv] -map [outa] -c:v mpeg4 -strict experimental -qscale:v 10
finalvideo.mp4









On 8/30/15, 12:48 PM, "ffmpeg-user on behalf of Chad Horton"
<ffmpeg-user-bounces at ffmpeg.org on behalf of
chorton at hotsalsainteractive.com> wrote:

>Hi,
>
>I need it to offset the audio of the overlay to match where I offset the
>video of the overlay.  The audio of the underlay video
>(output_2015-08-29_12-53-21.mp4) should not be moved.
>
>
>
>-----Original Message-----
>From: ffmpeg-user [mailto:ffmpeg-user-bounces at ffmpeg.org] On Behalf Of
>Paul B Mahol
>Sent: Sunday, August 30, 2015 12:46 AM
>To: FFmpeg user questions <ffmpeg-user at ffmpeg.org>
>Subject: Re: [FFmpeg-user] overlay with video offset not starting audio
>with same offset
>
>On 8/30/15, Chad Horton <chorton at hotsalsainteractive.com> wrote:
>> Thanks.
>>
>> Playing around with atrim and while the video processes, not only does
>> the overlay video freeze in places (it^1s choppy), the audio is also
>>off still.
>>  But I don^1t know if it^1s just an artifact of the video not
>> processing correctly.
>>
>> I did notice that if I execute with offset 00:00:00.000 and without
>> using the atrim filter, the video processes, the overlay plays cleanly.
>>
>> The difference in output when I execute with the itsoffset and atrim
>> is in the version with itsoffset > 0 and matching atrim, there^1s what
>> appears to be warnings - for example, "[Parsed_overlay_1 @
>> 0x7fef18c21000] [framesync @ 0x7fef1900b028] Buffer queue overflow,
>>dropping."
>
>Shouldn't you atrim [0:a] and not [1:a] ?
>>
>> Ffmpeg command and full output provided below.
>>
>>
>> ffmpeg -y -i output_2015-08-29_12-53-21.mp4 -itsoffset 2 -i
>> animations/chimp-01.mov -filter_complex
>> "[1:v]scale=1280:720[ovrl];[0v][ovrl]overlay=eof_action=pass[outv];[1:
>> a]atr im=2[1a];[0:a][1a]amix[outa]" -map [outv] -map [outa] -c:v mpeg4
>> -strict experimental -qscale:v 10 final_video_temp.mp4
>>
>>
>> ffmpeg version 2.6.2-tessus Copyright (c) 2000-2015 the FFmpeg
>>developers
>>   built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM
>>3.5svn)
>>   configuration: --cc=/usr/bin/clang
>> --prefix=/Users/helmutt/data/ext/ffmpeg/sw --as=yasm
>> --extra-version=tessus --disable-shared --enable-static
>> --disable-ffplay --enable-gpl --enable-pthreads --enable-postproc
>> --enable-libmp3lame --enable-libtheora --enable-libvorbis
>> --enable-libx264 --enable-libx265 --enable-libxvid --enable-libspeex
>> --enable-bzlib --enable-zlib --enable-libopencore-amrnb
>> --enable-libopencore-amrwb --enable-libxavs --enable-libsoxr
>> --enable-libwavpack --enable-version3 --enable-libvo-aacenc
>> --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm
>> --enable-libopus --enable-libmodplug --enable-fontconfig
>> --enable-libfreetype --enable-libass --enable-libbluray
>> --enable-filters --disable-indev=qtkit --disable-indev=x11grab_xcb
>>--enable-runtime-cpudetect
>>   libavutil      54. 20.100 / 54. 20.100
>>   libavcodec     56. 26.100 / 56. 26.100
>>   libavformat    56. 25.101 / 56. 25.101
>>   libavdevice    56.  4.100 / 56.  4.100
>>   libavfilter     5. 11.102 /  5. 11.102
>>   libswscale      3.  1.101 /  3.  1.101
>>   libswresample   1.  1.100 /  1.  1.100
>>   libpostproc    53.  3.100 / 53.  3.100
>> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
>>'output_2015-08-29_12-53-21.mp4':
>>   Metadata:
>>     major_brand     : mp42
>>     minor_version   : 0
>>     compatible_brands: isommp42
>>     creation_time   : 2015-08-29 19:53:36
>>   Duration: 00:00:13.19, start: 0.000000, bitrate: 10149 kb/s
>>     Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
>> 1280x720, 10004 kb/s, SAR 1:1 DAR 16:9, 29.98 fps, 30.02 tbr, 90k tbn,
>> 180k tbc (default)
>>     Metadata:
>>       creation_time   : 2015-08-29 19:53:36
>>       handler_name    : VideoHandle
>>       encoder         : MOTO
>>     Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
>> stereo, fltp, 128 kb/s (default)
>>     Metadata:
>>       creation_time   : 2015-08-29 19:53:36
>>       handler_name    : SoundHandle
>> Guessed Channel Layout for  Input Stream #1.1 : mono Input #1,
>> mov,mp4,m4a,3gp,3g2,mj2, from 'animations/chimp-01.mov':
>>   Metadata:
>>     major_brand     : qt
>>     minor_version   : 537199360
>>     compatible_brands: qt
>>     creation_time   : 2013-02-16 01:09:15
>>   Duration: 00:00:07.67, start: 0.000000, bitrate: 18997 kb/s
>>     Stream #1:0(eng): Video: png (png  / 0x20676E70), rgba, 640x360
>> [SAR
>> 2834:2834 DAR 16:9], 18270 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc
>>(default)
>>     Metadata:
>>       creation_time   : 2013-02-16 01:09:15
>>       handler_name    : Apple Alias Data Handler
>>       encoder         : PNG
>>       timecode        : 00:00:00:00
>>     Stream #1:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 44100 Hz,
>> 1 channels, s16, 705 kb/s (default)
>>     Metadata:
>>       creation_time   : 2013-02-16 01:09:15
>>       handler_name    : Apple Alias Data Handler
>>       timecode        : 00:00:00:00
>>     Stream #1:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
>>     Metadata:
>>       creation_time   : 2013-02-16 01:09:27
>>       handler_name    : Apple Alias Data Handler
>>       timecode        : 00:00:00:00
>> Output #0, mp4, to 'final_video_temp.mp4':
>>   Metadata:
>>     major_brand     : mp42
>>     minor_version   : 0
>>     compatible_brands: isommp42
>>     encoder         : Lavf56.25.101
>>     Stream #0:0: Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 1280x720
>> [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30.02 fps, 45k tbn, 30.02 tbc
>> (default)
>>     Metadata:
>>       encoder         : Lavc56.26.100 mpeg4
>>     Stream #0:1: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040),
>> 48000 Hz, stereo, s16, 128 kb/s (default)
>>     Metadata:
>>       encoder         : Lavc56.26.100 libvo_aacenc
>> Stream mapping:
>>   Stream #0:0 (h264) -> overlay:main
>>   Stream #0:1 (aac) -> amix:input0
>>   Stream #1:0 (png) -> scale
>>   Stream #1:1 (pcm_s16le) -> atrim
>>   overlay -> Stream #0:0 (mpeg4)
>>   amix -> Stream #0:1 (libvo_aacenc)
>> Press [q] to stop, [?] for help
>> [Parsed_overlay_1 @ 0x7fef18c21000] [framesync @ 0x7fef1900b028]
>> Buffer queue overflow, dropping.
>>     Last message repeated 14 times
>> [Parsed_overlay_1 @ 0x7fef18c21000] [framesync @ 0x7fef1900b028]
>> Buffer queue overflow, dropping.
>>     Last message repeated 2 times
>> [Parsed_overlay_1 @ 0x7fef18c21000] [framesync @ 0x7fef1900b028]
>> Buffer queue overflow, dropping.
>>     Last message repeated 14 times
>> [Parsed_overlay_1 @ 0x7fef18c21000] [framesync @ 0x7fef1900b028]
>> Buffer queue overflow, dropping.
>>     Last message repeated 2 times
>> frame=  396 fps=130 q=10.0 Lsize=    4326kB time=00:00:13.19
>> bitrate=2686.7kbits/s
>> video:4108kB audio:206kB subtitle:0kB other streams:0kB global
>> headers:0kB muxing overhead: 0.290611%
>>
>>
>>
>>
>>
>>
>> On 8/29/15, 7:58 AM, "ffmpeg-user on behalf of Paul B Mahol"
>> <ffmpeg-user-bounces at ffmpeg.org on behalf of onemda at gmail.com> wrote:
>>
>>>On 8/29/15, Chad Horton <chorton at hotsalsainteractive.com> wrote:
>>>> I didn't provide my attempts because I was randomly throwing adelay
>>>>and then
>>>> atrim into my command and nothing worked.   My hope is that someone
>>>>could
>>>> show me how to do it properly with my current command and adding in
>>>>the  atrim and/or adelay filter.
>>>
>>>This works for me:
>>>
>>>ffmpeg -i ~/matrixbench_mpeg2.mpg -itsoffset 00:00:20.000 -i
>>>~/GoneNutty.avi -lavfi
>>>"scale=640:512,vstack;[0:a]atrim=20[a],[1:a][a]amix" output.avi
>>>_______________________________________________
>>>ffmpeg-user mailing list
>>>ffmpeg-user at ffmpeg.org
>>>http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>_______________________________________________
>ffmpeg-user mailing list
>ffmpeg-user at ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>_______________________________________________
>ffmpeg-user mailing list
>ffmpeg-user at ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-user



More information about the ffmpeg-user mailing list