[FFmpeg-user] Record from webcam. Record video only is OK. Record video and audio fails.
Thomas Seilund
tps at netmaster.dk
Tue Feb 24 17:54:29 CET 2015
Hi All,
I record from a Logitech HD Pro C920 webcam.
Case 1 below
If I record video only then the play back is ok
Case 2 below
If I record video and audio then the play back runs way to fast.
Case 3 below
If I record audio only then the play back is ok.
Case 1:
tps at t420:~/temp$ ffmpeg -y -f v4l2 -r 24 -s 640x360 -i /dev/video1 -c:v
libx264 -preset ultrafast -pix_fmt yuv420p -r 24 -f mpegts test.ts
ffmpeg version N-69238-g2699a37 Copyright (c) 2000-2015 the FFmpeg
developers
built on Jan 24 2015 11:51:09 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --enable-gpl --enable-libmp3lame --enable-libvpx --enable-
libx264 --enable-version3 --enable-libvorbis --enable-x11grab --enable-
libfreetype --enable-libv4l2 --enable-libfdk-aac --enable-nonfree
libavutil 54. 17.100 / 54. 17.100
libavcodec 56. 20.100 / 56. 20.100
libavformat 56. 19.100 / 56. 19.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 8.101 / 5. 8.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, video4linux2,v4l2, from '/dev/video1':
Duration: N/A, start: 2169.388421, bitrate: 88473 kb/s
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x360,
88473 kb/s, 24 fps, 24 tbr, 1000k tbn, 1000k tbc
[libx264 @ 0x2f1ad60] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x2f1ad60] profile Constrained Baseline, level 3.0
Output #0, mpegts, to 'test.ts':
Metadata:
encoder : Lavf56.19.100
Stream #0:0: Video: h264 (libx264), yuv420p, 640x360, q=-1--1, 24 fps,
90k tbn, 24 tbc
Metadata:
encoder : Lavc56.20.100 libx264
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 145 fps= 24 q=-1.0 Lsize= 649kB time=00:00:06.04 bitrate=
880.0kbits/s
video:585kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 10.890488%
[libx264 @ 0x2f1ad60] frame I:1 Avg QP:20.00 size: 26181
[libx264 @ 0x2f1ad60] frame P:144 Avg QP:21.94 size: 3980
[libx264 @ 0x2f1ad60] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0x2f1ad60] mb P I16..4: 4.7% 0.0% 0.0% P16..4: 34.5% 0.0%
0.0% 0.0% 0.0% skip:60.8%
[libx264 @ 0x2f1ad60] coded y,uvDC,uvAC intra: 46.1% 56.4% 26.0% inter:
17.2% 14.2% 1.8%
[libx264 @ 0x2f1ad60] i16 v,h,dc,p: 34% 20% 24% 21%
[libx264 @ 0x2f1ad60] i8c dc,h,v,p: 47% 21% 21% 11%
[libx264 @ 0x2f1ad60] kb/s:793.57
tps at t420:~/temp$
Case 2
tps at t420:~/temp$ ffmpeg -y -f v4l2 -r 24 -s 640x360 -i /dev/video1 -f alsa -
ac 2 -i plughw:CARD=C920,DEV=0 -c:v libx264 -pix_fmt yuv420p -preset
ultrafast -r 24 -c:a aac -b:a 128k -ar 44100 -strict -2 -f mpegts test2.ts
ffmpeg version N-69238-g2699a37 Copyright (c) 2000-2015 the FFmpeg
developers
built on Jan 24 2015 11:51:09 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --enable-gpl --enable-libmp3lame --enable-libvpx --enable-
libx264 --enable-version3 --enable-libvorbis --enable-x11grab --enable-
libfreetype --enable-libv4l2 --enable-libfdk-aac --enable-nonfree
libavutil 54. 17.100 / 54. 17.100
libavcodec 56. 20.100 / 56. 20.100
libavformat 56. 19.100 / 56. 19.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 8.101 / 5. 8.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, video4linux2,v4l2, from '/dev/video1':
Duration: N/A, start: 2284.037947, bitrate: 88473 kb/s
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x360,
88473 kb/s, 24 fps, 24 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, alsa, from 'plughw:CARD=C920,DEV=0':
Duration: N/A, start: 1424795325.310924, bitrate: 1536 kb/s
Stream #1:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[libx264 @ 0x2d63700] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x2d63700] profile Constrained Baseline, level 3.0
Output #0, mpegts, to 'test2.ts':
Metadata:
encoder : Lavf56.19.100
Stream #0:0: Video: h264 (libx264), yuv420p, 640x360, q=-1--1, 24 fps,
90k tbn, 24 tbc
Metadata:
encoder : Lavc56.20.100 libx264
Stream #0:1: Audio: aac, 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc56.20.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[alsa @ 0x2d4eda0] ALSA buffer xrun. 215kB time=00:00:02.83 bitrate=
621.1kbits/s
[aac @ 0x2d64660] Queue input is backward in time
[mpegts @ 0x2d663c0] Non-monotonous DTS in output stream 0:1; previous:
345216, current: 289871; changing to 345217. This may result in incorrect
timestamps in the output file.
[mpegts @ 0x2d663c0] Non-monotonous DTS in output stream 0:1; previous:
345217, current: 322492; changing to 345218. This may result in incorrect
timestamps in the output file.
frame= 120 fps= 24 q=-1.0 Lsize= 348kB time=00:00:05.62 bitrate=
507.7kbits/s
video:299kB audio:9kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 13.187988%
[libx264 @ 0x2d63700] frame I:1 Avg QP:20.00 size: 25293
[libx264 @ 0x2d63700] frame P:119 Avg QP:20.86 size: 2362
[libx264 @ 0x2d63700] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0x2d63700] mb P I16..4: 1.7% 0.0% 0.0% P16..4: 37.3% 0.0%
0.0% 0.0% 0.0% skip:61.0%
[libx264 @ 0x2d63700] coded y,uvDC,uvAC intra: 25.1% 54.6% 19.6% inter:
13.5% 14.3% 0.9%
[libx264 @ 0x2d63700] i16 v,h,dc,p: 39% 19% 22% 20%
[libx264 @ 0x2d63700] i8c dc,h,v,p: 52% 19% 19% 10%
[libx264 @ 0x2d63700] kb/s:490.15
tps at t420:~/temp$
Case 3
tps at t420:~/temp$ ffmpeg -y -f alsa -ac 2 -i plughw:CARD=C920,DEV=0 -c:a aac
-b:a 128k -ar 44100 -strict -2 -f mpegts test3.tsffmpeg version N-69238-
g2699a37 Copyright (c) 2000-2015 the FFmpeg developers
built on Jan 24 2015 11:51:09 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --enable-gpl --enable-libmp3lame --enable-libvpx --enable-
libx264 --enable-version3 --enable-libvorbis --enable-x11grab --enable-
libfreetype --enable-libv4l2 --enable-libfdk-aac --enable-nonfree
libavutil 54. 17.100 / 54. 17.100
libavcodec 56. 20.100 / 56. 20.100
libavformat 56. 19.100 / 56. 19.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 8.101 / 5. 8.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'plughw:CARD=C920,DEV=0':
Duration: N/A, start: 1424796027.558246, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Output #0, mpegts, to 'test3.ts':
Metadata:
encoder : Lavf56.19.100
Stream #0:0: Audio: aac, 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc56.20.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
size= 106kB time=00:00:05.97 bitrate= 145.9kbits/s
video:0kB audio:93kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 14.524582%
tps at t420:~/temp$
Thanks
Thomas S
More information about the ffmpeg-user
mailing list