[FFmpeg-user] Can't make recording video and audio work

John darodymas at gmail.com
Sun Dec 3 19:05:40 EET 2017


Hello,

So at the moment I can record video only like this:

ffmpeg -f v4l2 -input_format mjpeg -s uhd2160 -i /dev/video0 -vcodec 
copy video.mp4

and audio only like this:

ffmpeg -f pulse -channels 1 -i default audio.wav

But I can't seem to make both record at the same time and I've tried it 
all. This is the closest I got so far that doesn't throw any errors:

ffmpeg -f v4l2 -input_format mjpeg -s uhd2160 -i /dev/video0 -f pulse 
-channels 1 -i default video.mp4

The above command produces following output, but doesn't record anything 
(output file is 0 bytes) and needs to be killed manually (pressing 'q' 
does nothing):

ffmpeg version 3.4-1~16.04.york0 Copyright (c) 2000-2017 the FFmpeg 
developers
   built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.5) 20160609
   configuration: --prefix=/usr --extra-version='1~16.04.york0' 
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu 
--incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping 
--enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa 
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca 
--enable-libcdio --enable-libflite --enable-libfontconfig 
--enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm 
--enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt 
--enable-libopus --enable-libpulse --enable-librubberband 
--enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex 
--enable-libssh --enable-libtheora --enable-libtwolame 
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp 
--enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi 
--enable-omx --enable-openal --enable-opengl --enable-sdl2 
--enable-libdc1394 --enable-libiec61883 --enable-chromaprint 
--enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
   libavutil      55. 78.100 / 55. 78.100
   libavcodec     57.107.100 / 57.107.100
   libavformat    57. 83.100 / 57. 83.100
   libavdevice    57. 10.100 / 57. 10.100
   libavfilter     6.107.100 /  6.107.100
   libavresample   3.  7.  0 /  3.  7.  0
   libswscale      4.  8.100 /  4.  8.100
   libswresample   2.  9.100 /  2.  9.100
   libpostproc    54.  7.100 / 54.  7.100
Input #0, video4linux2,v4l2, from '/dev/video0':
   Duration: N/A, start: 6061.105323, bitrate: N/A
     Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 
3840x2160, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : mono
Input #1, pulse, from 'default':
   Duration: N/A, start: 1512320284.610900, bitrate: 768 kb/s
     Stream #1:0: Audio: pcm_s16le, 48000 Hz, mono, s16, 768 kb/s
Stream mapping:
   Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
   Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x558ff21210e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 
SSE4.2 AVX
[libx264 @ 0x558ff21210e0] profile High 4:2:2, level 5.1, 4:2:2 8-bit
[libx264 @ 0x558ff21210e0] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 
AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - 
options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 
psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 
threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 
interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 
b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf 
mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 
aq=1:1.00
Output #0, mp4, to 'video.mp4':
   Metadata:
     encoder         : Lavf57.83.100
     Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), 
yuvj422p(pc, progressive), 3840x2160, q=-1--1, 30 fps, 15360 tbn, 30 tbc
     Metadata:
       encoder         : Lavc57.107.100 libx264
     Side data:
       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
     Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, 
fltp, 69 kb/s
     Metadata:
       encoder         : Lavc57.107.100 aac
frame=    1 fps=0.1 q=0.0 size=       0kB time=00:00:00.27 bitrate=   
0.0kbits/s speed=0.0204x

Any ideas how can I make it work? I need mono audio and both audio and 
video in lossless formats.


More information about the ffmpeg-user mailing list