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

2015-08-30 Thread Chad Horton
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-boun...@ffmpeg.org] On Behalf Of Paul B 
Mahol
Sent: Sunday, August 30, 2015 12:46 AM
To: FFmpeg user questions 
Subject: Re: [FFmpeg-user] overlay with video offset not starting audio with 
same offset

On 8/30/15, Chad Horton  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
>   libavformat56. 25.101 / 56. 25.101
>   libavdevice56.  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
>   libpostproc53.  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.00, 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.00, 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
> compatib

[FFmpeg-user] Audio/video capture out of synchronisation. Is my fix right?

2015-08-30 Thread MrNice
Hello

I use the following command:
./ffmpeg -debug 1 -f pulse -ar 44100 -ac 2 -channel_layout stereo
-thread_queue_size 512 -i alsa_input.pci-_00_14.2.analog-stereo -f
v4l2 -ts mono2abs -channel 1 -video_size 720x576 -pix_fmt yuyv422
-thread_queue_size 512 -i /dev/video0 -vf
drawbox=0:0:3:576:black@1:t=max,drawbox=718:0:3:576:black@1:t=max,drawbox=0:0:720:3:black@1:t=max,drawbox=0:565:720:11:black@1:t=max
-c:v ffv1 -level 3 -aspect 4:3 -pix_fmt yuv422p -c:a pcm_s16le
/Store3/Test/t_`date +%Y%m%d_%H%M`.mkv -aspect 4:3 -f sdl "Dazzle output"
See 1st output below

However even with -ts mon2abs option, I have a de-sync late audio of
around 150ms when I play the file with ffplay
I found a fix adding
-itsoffset -0.15
before
-i alsa_input.pci-_00_14.2.analog-stereo
See 2nd output below

This seems to work, remove the de-sinc but I have some very short
freezes in the sdl window. I checked the number of input and output
frames and packets, there are equal. Maybe this is only a display
freeze. Average CPU usage with System Monitor shows around 25-30%.

I want to know if this fix is OK.

BTW if I add -itsoffset -0.15 and I remove -ts mono2abs all is sync even
if start: of audio and start: of video are widely different:
  Duration: N/A, start: 1440954817.205196, bitrate: 1411 kb/s
  Duration: N/A, start: 34816.905351, bitrate: 165888 kb/s


Many thanks

1st output
 ./ffmpeg -debug 1 -f pulse -ar 44100 -ac 2 -channel_layout stereo
-thread_queue_size 512 -i alsa_input.pci-_00_14.2.analog-stereo -f
v4l2 -ts mono2abs -channel 1 -video_size 720x576 -pix_fmt yuyv422
-thread_queue_size 512 -i /dev/video0 -vf
drawbox=0:0:3:576:black@1:t=max,drawbox=718:0:3:576:black@1:t=max,drawbox=0:0:720:3:black@1:t=max,drawbox=0:565:720:11:black@1:t=max
-c:v ffv1 -level 3 -aspect 4:3 -pix_fmt yuv422p -c:a pcm_s16le
/Store3/Test/t_`date +%Y%m%d_%H%M`.mkv -aspect 4:3 -f sdl "Dazzle output"
ffmpeg version N-74714-g47b41fe Copyright (c) 2000-2015 the FFmpeg
developers
  built with gcc 5.1.1 (GCC) 20150618 (Red Hat 5.1.1-4)
  configuration: --enable-libpulse --enable-gpl --enable-libx264
  libavutil  54. 31.100 / 54. 31.100
  libavcodec 56. 59.100 / 56. 59.100
  libavformat56. 40.101 / 56. 40.101
  libavdevice56.  4.100 / 56.  4.100
  libavfilter 5. 40.100 /  5. 40.100
  libswscale  3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc53.  3.100 / 53.  3.100
 matched as AVOption 'debug' with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'pulse'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate
(in Hz)) with argument '44100'.
Reading option '-ac' ... matched as option 'ac' (set number of audio
channels) with argument '2'.
Reading option '-channel_layout' ... matched as option 'channel_layout'
(set channel layout) with argument 'stereo'.
Reading option '-thread_queue_size' ... matched as option
'thread_queue_size' (set the maximum number of queued packets from the
demuxer) with argument '512'.
Reading option '-i' ... matched as input file with argument
'alsa_input.pci-_00_14.2.analog-stereo'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'v4l2'.
Reading option '-ts' ... matched as AVOption 'ts' with argument 'mono2abs'.
Reading option '-channel' ... matched as AVOption 'channel' with
argument '1'.
Reading option '-video_size' ... matched as AVOption 'video_size' with
argument '720x576'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel
format) with argument 'yuyv422'.
Reading option '-thread_queue_size' ... matched as option
'thread_queue_size' (set the maximum number of queued packets from the
demuxer) with argument '512'.
Reading option '-i' ... matched as input file with argument '/dev/video0'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with
argument
'drawbox=0:0:3:576:black@1:t=max,drawbox=718:0:3:576:black@1:t=max,drawbox=0:0:720:3:black@1:t=max,drawbox=0:565:720:11:black@1:t=max'.
Reading option '-c:v' ... matched as option 'c' (codec name) with
argument 'ffv1'.
Reading option '-level' ... matched as AVOption 'level' with argument '3'.
Reading option '-aspect' ... matched as option 'aspect' (set aspect
ratio (4:3, 16:9 or 1., 1.)) with argument '4:3'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel
format) with argument 'yuv422p'.
Reading option '-c:a' ... matched as option 'c' (codec name) with
argument 'pcm_s16le'.
Reading option '/Store3/Test/t_20150830_1901.mkv' ... matched as output
file.
Reading option '-aspect' ... matched as option 'aspect' (set aspect
ratio (4:3, 16:9 or 1., 1.)) with argument '4:3'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'sdl'.
Reading option 'Dazzle output' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Successfully parsed a group of options.
Parsing a group of options: input file
al

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

2015-08-30 Thread Paul B Mahol
On 8/30/15, Chad Horton  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
>   libavformat56. 25.101 / 56. 25.101
>   libavdevice56.  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
>   libpostproc53.  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.00, 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.00, 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 (h2