[FFmpeg-user] Delayed sound in screencast
Artur Łącki
alacki93 at gmail.com
Fri Aug 23 11:45:14 CEST 2013
W dniu 23.08.2013 01:25, Carl Eugen Hoyos pisze:
> Please test the following: $ ffmpeg -f alsa -ac 2 -i default out2.wav
> $ ffmpeg -f alsa -ac 1 -i default out1.wav How do out1.wav and
> out2.wav sound?
Both files sounds good. Here are logs:
#########################################
artur at laptop:~/Wideo> ffmpeg -f alsa -ac 1 -i default out1.wav
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
built on Aug 17 2013 07:01:31 with gcc 4.7 (SUSE Linux)
configuration: --shlibdir=/usr/lib64 --prefix=/usr
--mandir=/usr/share/man --libdir=/usr/lib64 --enable-shared
--disable-static --enable-debug --disable-stripping
--extra-cflags='-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -fPIC
-I/usr/include/gsm' --enable-gpl --enable-x11grab --enable-version3
--enable-pthreads --enable-avfilter --enable-libpulse --enable-libvpx
--enable-libopus --enable-libass --enable-libmp3lame --enable-libvorbis
--enable-libtheora --enable-libspeex --enable-libxvid --enable-libx264
--enable-libschroedinger --enable-libgsm --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-postproc --enable-libdc1394
--enable-librtmp --enable-libfreetype --enable-avresample
--enable-libtwolame --enable-libvo-aacenc
libavutil 52. 38.100 / 52. 38.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.100 / 55. 12.100
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 79.101 / 3. 79.101
libavresample 1. 1. 0 / 1. 1. 0
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, alsa, from 'default':
Duration: N/A, start: 1377250478.523785, bitrate: 768 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, mono, s16, 768 kb/s
File 'out1.wav' already exists. Overwrite ? [y/N] y
Output #0, wav, to 'out1.wav':
Metadata:
ISFT : Lavf55.12.100
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz,
mono, s16, 768 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le)
Press [q] to stop, [?] for help
size= 1950kB time=00:00:20.79 bitrate= 768.0kbits/s
video:0kB audio:1950kB subtitle:0 global headers:0kB muxing overhead
0.004007%
#########################################
artur at laptop:~/Wideo> ffmpeg -f alsa -ac 2 -i default out2.wav
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
built on Aug 17 2013 07:01:31 with gcc 4.7 (SUSE Linux)
configuration: --shlibdir=/usr/lib64 --prefix=/usr
--mandir=/usr/share/man --libdir=/usr/lib64 --enable-shared
--disable-static --enable-debug --disable-stripping
--extra-cflags='-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -fPIC
-I/usr/include/gsm' --enable-gpl --enable-x11grab --enable-version3
--enable-pthreads --enable-avfilter --enable-libpulse --enable-libvpx
--enable-libopus --enable-libass --enable-libmp3lame --enable-libvorbis
--enable-libtheora --enable-libspeex --enable-libxvid --enable-libx264
--enable-libschroedinger --enable-libgsm --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-postproc --enable-libdc1394
--enable-librtmp --enable-libfreetype --enable-avresample
--enable-libtwolame --enable-libvo-aacenc
libavutil 52. 38.100 / 52. 38.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.100 / 55. 12.100
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 79.101 / 3. 79.101
libavresample 1. 1. 0 / 1. 1. 0
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'default':
Duration: N/A, start: 1377250501.230443, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
File 'out2.wav' already exists. Overwrite ? [y/N] y
Output #0, wav, to 'out2.wav':
Metadata:
ISFT : Lavf55.12.100
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz,
stereo, s16, 1536 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le)
Press [q] to stop, [?] for help
size= 4053kB time=00:00:21.61 bitrate=1536.0kbits/s
video:0kB audio:4053kB subtitle:0 global headers:0kB muxing overhead
0.001927%
#########################################
> But you didn't tell us which scripts are "magical"...
>
Here is example "magical" script (source
http://dl.dropboxusercontent.com/u/28788188/cast.sh )
##############################ffmpeg/avconv Screencast script###################################################################################################################
#--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#packages needed: libavcodec-extra-xx libvorbis libx264-xx ffmpeg (ubuntu package names); libavc1394 ffmpeg gstreamer0.10-ffmpeg x264(arch packages)
#--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#PROTIP: add keyboard shortcuts for starting the script like: /your/script/location/cast.sh and stoping shortcut with the command: killall ffmpeg (or avconv if you using that)
#--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#script by Xpander
#--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#date function
DATE=`which date`
#mount ramdisk (uncomment and change if you want to use ramdisk - dont forget to change directory as well)
#gksu mount -t tmpfs -o size=3096M tmpfs /tmp/ramdisk/
#package select (avconv or ffmpeg)
RECORDER=ffmpeg
#How many threads used (0 for automatic)
THREADS=0
#Resolution
RESO=1920x1080
#Xserver Display number(:0.0 is default)
XDISP=:0.0
#Audio Device
AUDIO=alsa
#Channels
CHANNELS=2
#SoundCard (pulse for pulseaudio, hw:0,1 for directly communicating with your soundcard - use aplay -l to see whats your value)
SOUNDCARD=pulse
#Frames per second
FPS=30
#Constant Rate Factor(0 is the highest quality 50 is the lowest)
CRF=20
#libx264 presets(slow, fast, superfast, ultrafast; additionaly check sudo find /usr -iname '*.ffpreset' for more)
PRESET=ultrafast
#Audio Codec (libmp3lame, pcm_s16le or libvorbis are most common)
ACODEC=libvorbis
#Directory where your video is gonna be saved.(include / at the end)
DIRECTORY=$HOME/Videos/
#File name
FILENAME=videocast`$DATE +%d%m%Y_%H.%M.%S`.mp4
#script
$RECORDER -f $AUDIO -ac $CHANNELS -i $SOUNDCARD -f x11grab -r $FPS -s $RESO -i $XDISP -vcodec libx264 -preset $PRESET -crf $CRF -acodec $ACODEC -ab 256k -f mp4 -threads $THREADS $DIRECTORY$FILENAME
#old examples
##sample:ffmpeg -f alsa -ac 2 -i hw:0,1 -f x11grab -r 30 -s 1280x1024 -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 output.avi
#sample2:avconv -f alsa -i pulse -f x11grab -r 25 -s 1920x1080 -i :0.0 -vcodec mpeg4 -b 12000k -g 300 -bf 2 -acodec libmp3lame -ab 256k Screencast.avi
#sample3:ffmpeg -threads 0 -f alsa -i pulse -f x11grab -s 1280x720 -r 30 -i :0.0+0,0 -vcodec libx264 -preset superfast -crf 16 -acodec libmp3lame -ab 256k -ar 44100 -f mp4 screencast.mp4
--
===========
Pozdrawiam
Artur Łącki
===========
More information about the ffmpeg-user
mailing list