[FFmpeg-trac] #3728(avdevice:new): v4l TV Sound Problem: Silent Sound In Captured File

FFmpeg trac at avcodec.org
Thu Jun 19 15:39:52 CEST 2014


#3728: v4l TV Sound Problem: Silent Sound In Captured File
----------------------------------+---------------------------------------
             Reporter:  llarevo   |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  avdevice  |                  Version:  unspecified
             Keywords:            |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
----------------------------------+---------------------------------------
 When capturing from v4l, sound is silent in resulting file.
 {{{
 ffmpeg -y -f alsa -i hw:1 -f video4linux2 -i /dev/video0 -aspect 4/3
 -format vob -target pal-dvd out.mpg

 ffmpeg version 1.2.6 Copyright (c) 2000-2014 the FFmpeg developers
   built on Mar  5 2014 08:21:01 with gcc 4.8.2 (GCC) 20131212 (Red Hat
 4.8.2-7)
   configuration: --prefix=/usr --bindir=/usr/bin
 --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg
 --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2
 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
 --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'
 --enable-bzlib --disable-crystalhd --enable-frei0r --enable-gnutls
 --enable-libass --enable-libcelt --enable-libdc1394 --disable-indev=jack
 --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal
 --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse
 --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-
 libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-
 libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-
 postproc --enable-pthreads --disable-static --enable-shared --enable-gpl
 --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-
 runtime-cpudetect
   libavutil      52. 18.100 / 52. 18.100
   libavcodec     54. 92.100 / 54. 92.100
   libavformat    54. 63.104 / 54. 63.104
   libavdevice    54.  3.103 / 54.  3.103
   libavfilter     3. 42.103 /  3. 42.103
   libswscale      2.  2.100 /  2.  2.100
   libswresample   0. 17.102 /  0. 17.102
   libpostproc    52.  2.100 / 52.  2.100
 [alsa @ 0xb82ce0] Estimating duration from bitrate, this may be inaccurate
 Guessed Channel Layout for  Input Stream #0.0 : stereo
 Input #0, alsa, from 'hw:0':
   Duration: N/A, start: 1403183466.432025, bitrate: 1536 kb/s
     Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
 (... many errors, see BUG 1570)
 frame=   35 fps= 25 q=4.4 Lsize=    1282kB time=00:00:01.40
 bitrate=7487.4kbits/s
 video:1180kB audio:77kB subtitle:0 global headers:0kB muxing overhead
 2.000036%
 Received signal 2: terminating.
 }}}

 It seems, that ffmpeg changes the mute-level of the sound device somehow.
 I played around with "arecord -D plughw:SAA7134 -f cd | aplay" and
 alsamixer. Doing this I found out, that Line 2 on card 2 is the input-
 device with the TV-Sound on my TV-card. I can set this input via
 {{{
 amixer -c 1 sset 'Line',2 100%,100% unmute cap
 }}}

 After starting ffmpeg the capture-input is always set back to Video 0. The
 odd thing is, that even with re-setting the capture input back to Line 2
 via amixer, the resulting mpeg is completely silent. It doesn't record the
 sound after changing the input source back to the correct Line 2.

 When  "arecord -D plughw:SAA7134 -f cd | aplay" is running, I hear
 immediately the selected source. It's either silent (Video 0, via amixer
 -c 1 sset 'Video',0 100%,100% unmute cap) or the tv sound (Line 2, via
 amixer -c 1 sset 'Line',2 100%,100% unmute cap). When ffmpeg records, the
 change of the input source has no effect.

 Below you find the complete command lines. mplayer, tvtime and mencoder
 work without these problems.

 Select and configure v4l-Source

 {{{
 v4lctl -c /dev/video0 setchannel E6
 v4lctl -c /dev/video0 setnorm PAL-BG
 v4lctl -c /dev/video0 setinput 0
 v4lctl -c /dev/video0 setattr mute off
 v4lctl -c /dev/video0 volume 15
 v4lctl -c /dev/video0 setattr automute off
 v4lctl -c /dev/video0 setattr "audio mode" stereo
 v4lctl -c /dev/video0 show
 norm: PAL-BG
 input: Television
 audio mode: stereo
 bright: 128
 contrast: 68
 color: 64
 hue: 0
 volume: 15
 mute: off
 Mirror: off
 Invert: off
 y offset odd field: 0
 y offset even field: 0
 automute: off
 }}}

 Make TV-sound-device audible:
 {{{
 arecord -D plughw:SAA7134 -f cd | aplay
 }}}
 I made some experiments with alsa-mixer, from these I know, that Line 2 is
 the correct capture source in my case. I switch to Line 2 Input:
 {{{
 amixer -c 1 sset 'Line',2 100%,100% unmute cap
 }}}
 That succeeds, I hear the TV-sound and the input is set properly:
 {{{
 amixer -c1
 Simple mixer control 'Line',1
   Capabilities: volume cswitch
   Playback channels: Front Left - Front Right
   Capture channels: Front Left - Front Right
   Limits: 0 - 20
   Front Left: 20 [100%] Capture [off]
   Front Right: 20 [100%] Capture [off]
 Simple mixer control 'Line',2
   Capabilities: volume cswitch
   Playback channels: Front Left - Front Right
   Capture channels: Front Left - Front Right
   Limits: 0 - 20
   Front Left: 20 [100%] Capture [on]       <!------ OK
   Front Right: 20 [100%] Capture [on]      <!------ OK
 Simple mixer control 'Video',0
   Capabilities: volume cswitch
   Playback channels: Front Left - Front Right
   Capture channels: Front Left - Front Right
   Limits: 0 - 20
   Front Left: 20 [100%] Capture [off]
   Front Right: 20 [100%] Capture [off]
 }}}

 I start the capture
 {{{
 ffmpeg -loglevel debug -f alsa -i hw:SAA7134 -f video4linux2 -i
 /dev/video0 -flags +ilme+ildct -aspect 4/3 -target pal-dvd -y test.mpg
 }}}
 After finishing the above ffmpeg-command, the resulting mpeg is silent and
 the input changed:
 {{{
 amixer -c1
 Simple mixer control 'Line',1
   Capabilities: volume cswitch
   Playback channels: Front Left - Front Right
   Capture channels: Front Left - Front Right
   Limits: 0 - 20
   Front Left: 20 [100%] Capture [off]
   Front Right: 20 [100%] Capture [off]
 Simple mixer control 'Line',2
   Capabilities: volume cswitch
   Playback channels: Front Left - Front Right
   Capture channels: Front Left - Front Right
   Limits: 0 - 20
   Front Left: 20 [100%] Capture [off]
   Front Right: 20 [100%] Capture [off]
 Simple mixer control 'Video',0
   Capabilities: volume cswitch
   Playback channels: Front Left - Front Right
   Capture channels: Front Left - Front Right
   Limits: 0 - 20
   Front Left: 20 [100%] Capture [on]      <!------ wrong
   Front Right: 20 [100%] Capture [on]     <!------ wrong
 }}}

 I asked for help on this error about one year ago in ffmpeg-users:
 https://lists.ffmpeg.org/pipermail/ffmpeg-user/2013-March/014217.html

--
Ticket URL: <https://trac.ffmpeg.org/ticket/3728>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list