Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#3956 closed defect (needs_more_info)

capturing with h264 codec with built-in hw c920 produce intermittent pause

Reported by: gtzen Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: h264 v4l2
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

While using a logitech c920 build-in hw codec to capture the video from webcam, it produces slight random intermittent pause in the captured video (that makes look like frames jump from one to another)

How to reproduce:

% ffmpeg -report -s 1920x1080 -f v4l2 -vcodec h264 -i /dev/video0 -copyinkf -vcodec copy test_directly_processed_by_c920-another-attempt1.mp4
%cat ffmpeg-20140917-084550.log
ffmpeg started on 2014-09-17 at 08:45:50
Report written to "ffmpeg-20140917-084550.log"
Command line:
ffmpeg -report -s 1920x1080 -f v4l2 -vcodec h264 -i /dev/video0 -vcodec copy test_directly_processed_by_c920-another-attempt1.mp4
ffmpeg version 2.4 Copyright (c) 2000-2014 the FFmpeg developers
  built on Sep 15 2014 01:02:34 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
  configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-x11grab --enable-libpulse --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or abbreviation)) with argument '1920x1080'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'v4l2'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'h264'.
Reading option '-i' ... matched as input file with argument '/dev/video0'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'copy'.
Reading option 'test_directly_processed_by_c920-another-attempt1.mp4' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file /dev/video0.
Applying option s (set frame size (WxH or abbreviation)) with argument 1920x1080.
Applying option f (force format) with argument v4l2.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument h264.
Successfully parsed a group of options.
Opening an input file: /dev/video0.
[video4linux2,v4l2 @ 0x305a4e0] fd:4 capabilities:84000001
[video4linux2,v4l2 @ 0x305a4e0] Current input_channel: 0, input_name: Camera 1, input_std: 0
[h264 @ 0x305ae00] Current profile doesn't provide more RBSP data in PPS, skipping
[video4linux2,v4l2 @ 0x305a4e0] All info found
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 5317.791377, bitrate: N/A
    Stream #0:0, 8, 1/1000000: Video: h264 (Constrained Baseline), yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:9], -4 kb/s, 24 fps, 24 tbr, 1000k tbn, 60 tbc
Successfully opened the file.
Parsing a group of options: output file test_directly_processed_by_c920-another-attempt1.mp4.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument copy.
Successfully parsed a group of options.
Opening an output file: test_directly_processed_by_c920-another-attempt1.mp4.
Successfully opened the file.
Output #0, mp4, to 'test_directly_processed_by_c920-another-attempt1.mp4':
  Metadata:
    encoder         : Lavf56.4.101
    Stream #0:0, 0, 1/1000000: Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, -4 kb/s, 24 fps, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x3115fe0] Non-monotonous DTS in output stream 0:0; previous: 0, current: -214627; changing to 1. This may result in incorrect timestamps in the output file.
[mp4 @ 0x3115fe0] Non-monotonous DTS in output stream 0:0; previous: 1, current: -174633; changing to 2. This may result in incorrect timestamps in the output file.
[mp4 @ 0x3115fe0] Non-monotonous DTS in output stream 0:0; previous: 2, current: -130641; changing to 3. This may result in incorrect timestamps in the output file.
[mp4 @ 0x3115fe0] Non-monotonous DTS in output stream 0:0; previous: 3, current: -90647; changing to 4. This may result in incorrect timestamps in the output file.
[mp4 @ 0x3115fe0] Non-monotonous DTS in output stream 0:0; previous: 4, current: -50653; changing to 5. This may result in incorrect timestamps in the output file.
[mp4 @ 0x3115fe0] Non-monotonous DTS in output stream 0:0; previous: 5, current: -6660; changing to 6. This may result in incorrect timestamps in the output file.
[mp4 @ 0x3115fe0] Non-monotonous DTS in output stream 0:0; previous: 449296, current: 310695; changing to 449297. This may result in incorrect timestamps in the output file.
[mp4 @ 0x3115fe0] Non-monotonous DTS in output stream 0:0; previous: 449297, current: 347879; changing to 449298. This may result in incorrect timestamps in the output file.
frame=   20 fps=0.0 q=-1.0 size=     349kB time=00:00:00.44 bitrate=6370.4kbits/s    
[mp4 @ 0x3115fe0] Non-monotonous DTS in output stream 0:0; previous: 449298, current: 384674; changing to 449299. This may result in incorrect timestamps in the output file.
[mp4 @ 0x3115fe0] Non-monotonous DTS in output stream 0:0; previous: 449299, current: 421670; changing to 449300. This may result in incorrect timestamps in the output file.
frame=   33 fps= 32 q=-1.0 size=     542kB time=00:00:01.07 bitrate=4143.2kbits/s    
frame=   48 fps= 31 q=-1.0 size=     740kB time=00:00:01.48 bitrate=4072.7kbits/s    
frame=   63 fps= 31 q=-1.0 size=     934kB time=00:00:01.94 bitrate=3926.7kbits/s    
frame=   79 fps= 31 q=-1.0 size=    1137kB time=00:00:02.42 bitrate=3847.8kbits/s    
frame=   94 fps= 31 q=-1.0 size=    1323kB time=00:00:03.14 bitrate=3442.6kbits/s    
frame=  109 fps= 31 q=-1.0 size=    1497kB time=00:00:03.55 bitrate=3449.2kbits/s    
frame=  124 fps= 30 q=-1.0 size=    1683kB time=00:00:04.00 bitrate=3443.3kbits/s    
frame=  140 fps= 31 q=-1.0 size=    1878kB time=00:00:04.47 bitrate=3435.2kbits/s    
frame=  155 fps= 30 q=-1.0 size=    2071kB time=00:00:04.92 bitrate=3448.2kbits/s    
frame=  170 fps= 30 q=-1.0 size=    2259kB time=00:00:05.62 bitrate=3287.6kbits/s    
frame=  185 fps= 30 q=-1.0 size=    2440kB time=00:00:06.06 bitrate=3296.8kbits/s    
frame=  201 fps= 30 q=-1.0 size=    2632kB time=00:00:06.53 bitrate=3298.7kbits/s    
frame=  216 fps= 30 q=-1.0 size=    2809kB time=00:00:06.97 bitrate=3297.9kbits/s    
frame=  231 fps= 30 q=-1.0 size=    2993kB time=00:00:07.69 bitrate=3184.7kbits/s    
frame=  246 fps= 30 q=-1.0 size=    3173kB time=00:00:08.10 bitrate=3206.4kbits/s    
frame=  262 fps= 30 q=-1.0 size=    3370kB time=00:00:08.59 bitrate=3213.1kbits/s    
frame=  277 fps= 30 q=-1.0 size=    3549kB time=00:00:09.03 bitrate=3217.4kbits/s    
frame=  292 fps= 30 q=-1.0 size=    3735kB time=00:00:09.47 bitrate=3227.6kbits/s    
[NULL @ 0x305ae00] Current profile doesn't provide more RBSP data in PPS, skipping
frame=  307 fps= 30 q=-1.0 size=    3944kB time=00:00:10.17 bitrate=3174.2kbits/s    
frame=  323 fps= 30 q=-1.0 size=    4140kB time=00:00:10.65 bitrate=3184.8kbits/s    
frame=  338 fps= 30 q=-1.0 size=    4323kB time=00:00:11.09 bitrate=3192.8kbits/s    
frame=  353 fps= 30 q=-1.0 size=    4507kB time=00:00:11.53 bitrate=3200.8kbits/s    
frame=  369 fps= 30 q=-1.0 size=    4701kB time=00:00:12.27 bitrate=3136.5kbits/s    
frame=  384 fps= 30 q=-1.0 size=    4886kB time=00:00:12.70 bitrate=3149.6kbits/s    
frame=  399 fps= 30 q=-1.0 size=    5066kB time=00:00:13.15 bitrate=3156.1kbits/s    
frame=  414 fps= 30 q=-1.0 size=    5250kB time=00:00:13.59 bitrate=3163.7kbits/s    
frame=  430 fps= 30 q=-1.0 size=    5446kB time=00:00:14.06 bitrate=3171.8kbits/s    
frame=  445 fps= 30 q=-1.0 size=    5631kB time=00:00:14.75 bitrate=3125.5kbits/s    
frame=  460 fps= 30 q=-1.0 size=    5813kB time=00:00:15.20 bitrate=3131.0kbits/s    
frame=  475 fps= 30 q=-1.0 size=    5995kB time=00:00:15.65 bitrate=3138.1kbits/s    
frame=  491 fps= 30 q=-1.0 size=    6191kB time=00:00:16.12 bitrate=3145.8kbits/s    
frame=  506 fps= 30 q=-1.0 size=    6376kB time=00:00:16.82 bitrate=3104.0kbits/s    
frame=  521 fps= 30 q=-1.0 size=    6560kB time=00:00:17.26 bitrate=3112.5kbits/s    
frame=  536 fps= 30 q=-1.0 size=    6742kB time=00:00:17.70 bitrate=3118.7kbits/s    
frame=  552 fps= 30 q=-1.0 size=    6939kB time=00:00:18.18 bitrate=3126.6kbits/s    
frame=  567 fps= 30 q=-1.0 size=    7122kB time=00:00:18.90 bitrate=3086.8kbits/s    
frame=  582 fps= 30 q=-1.0 size=    7304kB time=00:00:19.30 bitrate=3098.6kbits/s    
frame=  597 fps= 30 q=-1.0 size=    7487kB time=00:00:19.76 bitrate=3103.0kbits/s    
[NULL @ 0x305ae00] Current profile doesn't provide more RBSP data in PPS, skipping
frame=  613 fps= 30 q=-1.0 size=    7708kB time=00:00:20.23 bitrate=3119.9kbits/s    
frame=  628 fps= 30 q=-1.0 size=    7868kB time=00:00:20.68 bitrate=3116.8kbits/s    
frame=  643 fps= 30 q=-1.0 size=    8052kB time=00:00:21.38 bitrate=3084.9kbits/s    
frame=  659 fps= 30 q=-1.0 size=    8246kB time=00:00:21.85 bitrate=3091.2kbits/s    
frame=  674 fps= 30 q=-1.0 size=    8429kB time=00:00:22.29 bitrate=3097.0kbits/s    
frame=  689 fps= 30 q=-1.0 size=    8612kB time=00:00:22.73 bitrate=3102.7kbits/s    
frame=  704 fps= 30 q=-1.0 size=    8796kB time=00:00:23.45 bitrate=3072.0kbits/s    
frame=  720 fps= 30 q=-1.0 size=    8991kB time=00:00:23.91 bitrate=3080.6kbits/s    
frame=  735 fps= 30 q=-1.0 size=    9174kB time=00:00:24.35 bitrate=3086.1kbits/s    
frame=  750 fps= 30 q=-1.0 size=    9359kB time=00:00:24.79 bitrate=3091.8kbits/s    
frame=  765 fps= 30 q=-1.0 size=    9541kB time=00:00:25.23 bitrate=3096.9kbits/s    
frame=  781 fps= 30 q=-1.0 size=    9737kB time=00:00:25.96 bitrate=3072.4kbits/s    
frame=  796 fps= 30 q=-1.0 size=    9920kB time=00:00:26.41 bitrate=3077.0kbits/s    
frame=  811 fps= 30 q=-1.0 size=   10103kB time=00:00:26.85 bitrate=3082.0kbits/s    
frame=  826 fps= 30 q=-1.0 size=   10286kB time=00:00:27.29 bitrate=3087.0kbits/s    
frame=  842 fps= 30 q=-1.0 size=   10481kB time=00:00:28.03 bitrate=3062.7kbits/s    
frame=  857 fps= 30 q=-1.0 size=   10666kB time=00:00:28.46 bitrate=3069.3kbits/s    
frame=  872 fps= 30 q=-1.0 size=   10848kB time=00:00:28.91 bitrate=3073.8kbits/s    
frame=  887 fps= 30 q=-1.0 size=   11032kB time=00:00:29.35 bitrate=3078.8kbits/s    
[NULL @ 0x305ae00] Current profile doesn't provide more RBSP data in PPS, skipping
frame=  903 fps= 30 q=-1.0 size=   11257kB time=00:00:30.10 bitrate=3062.6kbits/s    
frame=  918 fps= 30 q=-1.0 size=   11432kB time=00:00:30.51 bitrate=3069.1kbits/s    
frame=  933 fps= 30 q=-1.0 size=   11593kB time=00:00:30.96 bitrate=3066.6kbits/s    
frame=  949 fps= 30 q=-1.0 size=   11789kB time=00:00:31.44 bitrate=3071.7kbits/s    
frame=  964 fps= 30 q=-1.0 size=   11972kB time=00:00:31.88 bitrate=3075.8kbits/s    
frame=  967 fps= 30 q=-1.0 Lsize=   12021kB time=00:00:31.97 bitrate=3079.8kbits/s    
video:12008kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.101403%
Input file #0 (/dev/video0):
  Input stream #0:0 (video): 967 packets read (12296531 bytes); 
  Total: 967 packets (12296531 bytes) demuxed
Output file #0 (test_directly_processed_by_c920-another-attempt1.mp4):
  Output stream #0:0 (video): 967 packets muxed (12296531 bytes); 
  Total: 967 packets (12296531 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x31153a0] Statistics: 34 seeks, 997 writeouts

Any input to overcome this? Thanks!

Change History (5)

comment:1 by Carl Eugen Hoyos, 10 years ago

Component: ffmpegundetermined
Keywords: h264 added; ffmpeg c920 copyinkf removed
Priority: criticalnormal

Please test current FFmpeg git head.
Does removing -copyinkf make a difference? If not, please remove it.

comment:2 by gtzen, 10 years ago

Removal of -copyinkf does not make difference. Tried already.

However if I process the same video again in avidemux copying the video codec and save to the same format, the video becomes smooth, fyi!

Also, when I stream using vlc, it works flawlessly.

Last edited 10 years ago by gtzen (previous) (diff)

comment:3 by holden, 10 years ago

Keywords: v4l2 added

comment:4 by Clément Bœsch, 10 years ago

Resolution: needs_more_info
Status: newclosed

According to ribasushi (IRC / #ffmpeg), this might be due to a bug in the kernel: http://sourceforge.net/p/linux-uvc/mailman/message/33164469/

Maybe there is something to improve in our API usage, but it's apparently a regression in the Linux kernel since it's not supposed to break userland, so I'm closing the ticket for now. Feel free to re-open if you don't think it's justified.

comment:5 by Clément Bœsch, 9 years ago

14:10 <ribasushi> ubitux: in case you want to add more info to https://trac.ffmpeg.org/ticket/3956
14:10 <ribasushi> ubitux: final resolution is this (patch referenced within at [4]): https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=794327
Note: See TracTickets for help on using tickets.