Opened 12 years ago

Closed 12 years ago

#2404 closed defect (needs_more_info)

When the video with "white background" the display is gray

Reported by: Ken Owned by:
Priority: normal Component: undetermined
Version: 1.2 Keywords: v4l2
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
I use ffmpeg to encode Tv singal,when the video background is white,the image will display gray (the image will full white with some black line).
How to reproduce:

ffmpeg -f video4linux2 -s 720:480 -i /dev/video0 -f alsa -i hw:0,0 -vcodec libx264 -pix_fmt yuv420p -acodec libfaac -b:v 4000k -b:a 128k mytest.mp4
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar 25 2013 15:32:48 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-gpl --enable-postproc --enable-nonfree --enable-network --enable-protocol=tcp --enable-demuxer=rtsp --enable-decoder=h264 --enable-zlib
  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
[video4linux2,v4l2 @ 0x214a5a0] Estimating duration from bitrate, this may be inaccurate
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 1364276769.068877, bitrate: 165722 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 720x480, 165722 k b/s, 29.97 fps, 29.97 tbr, 1000k tbn, 1000k tbc
[alsa @ 0x214be60] Estimating duration from bitrate, this may be inaccurate Guessed Channel Layout for  Input Stream #1.0 : stereo
Input #1, alsa, from 'hw:0,0':
  Duration: N/A, start: 1364276769.073010, bitrate: 1536 kb/s
    Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[libx264 @ 0x215d2c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 @ 0x215d2c0] profile High, level 3.0
[libx264 @ 0x215d2c0] 264 - core 129 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 an           alyse=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=36 lookahead_threads=6 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=abr mbtree=1 bitrate=4000 ratetol=1.0 qcomp=0.60 min=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'mytest.mp4':
  Metadata:
    encoder         : Lavf54.63.104
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 720x480, q=-1--1, 4000 kb/s, 30k tbn, 29.97 tbc
    Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 128kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> libx264)
  Stream #1:0 -> #0:1 (pcm_s16le -> libfaac)
Press [q] to stop, [?] for help
frame=   17 fps=0.0 q=0.0 size=       0kB time=00:00:00.42 bitrate=   0.9kbits/s                                                  frame=   32 fps= 32 q=0.0 size=       0kB time=00:00:00.94 bitrate= 0.4kbits/s                                            frame=   47 fps= 31 q=0.0 size=       0kB time=00:00:01.43 bitrate=   0.3kbits/s                                                       frame=   62 fps= 31 q=0.0 size=       0kB time=00:00:01.92 bitrate=   0.2kbits/s                                                      frame=   70 fps= 24 q=32766.0 Lsize=     966kB time=00:00:02.30 bitrate=3432.8kb its/s video:926kB audio:36kB subtitle:0 global headers:0kB muxing overhead 0.475477%
[libx264 @ 0x215d2c0] frame I:1     Avg QP:14.29  size: 86439
[libx264 @ 0x215d2c0] frame P:19    Avg QP:16.92  size: 28464
[libx264 @ 0x215d2c0] frame B:50    Avg QP:20.94  size:  6410
[libx264 @ 0x215d2c0] consecutive B-frames:  2.9%  0.0% 17.1% 80.0%
[libx264 @ 0x215d2c0] mb I  I16..4:  8.7% 52.1% 39.2%
[libx264 @ 0x215d2c0] mb P  I16..4:  0.5%  3.6%  1.1%  P16..4: 38.1% 28.9% 20.2% 0.0%  0.0%    skip: 7.6%
[libx264 @ 0x215d2c0] mb B  I16..4:  0.1%  0.0%  0.0%  B16..8: 40.1%  6.7%  1.7%  direct: 8.1%  skip:43.2%  L0:34.1% L1:51.3% BI:14.7%
[libx264 @ 0x215d2c0] final ratefactor: 12.79
[libx264 @ 0x215d2c0] 8x8 transform intra:59.6% inter:59.4%
[libx264 @ 0x215d2c0] coded y,uvDC,uvAC intra: 91.2% 91.3% 79.5% inter: 30.5% 41.7% 19.9%
[libx264 @ 0x215d2c0] i16 v,h,dc,p: 18% 37%  2% 42%
[libx264 @ 0x215d2c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 24% 11%  4%  6%  8%  7% 7% 11%
[libx264 @ 0x215d2c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 31%  8%  5%  7%  7%  8% 6%  9%
[libx264 @ 0x215d2c0] i8c dc,h,v,p: 38% 32% 19% 12%
[libx264 @ 0x215d2c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x215d2c0] ref P L0: 52.3% 12.3% 27.6%  7.7%
[libx264 @ 0x215d2c0] ref B L0: 83.8% 14.2%  2.0%
[libx264 @ 0x215d2c0] ref B L1: 90.3%  9.7%
[libx264 @ 0x215d2c0] kb/s:3246.24
Received signal 2: terminating.

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (4)

comment:1 by Carl Eugen Hoyos, 12 years ago

Component: FFmpegundetermined
Keywords: v4l2 added; white background removed
Priority: importantnormal

Do you think this is a regression?

Is the problem only reproducible if you use an external library (libx264) or also with a native encoder?
Is it reproducible with current git head?
Is audio necessary to reproduce the problem?
What happens if you remove "-s 720:480" from your command line?
And please provide the output of the following command:
$ ffmpeg -list_formats all -f v4l2 -i /dev/video0

in reply to:  1 ; comment:2 by Ken, 12 years ago

Replying to cehoyos:

Do you think this is a regression?

Is the problem only reproducible if you use an external library (libx264) or also with a native encoder?
Is it reproducible with current git head?
Is audio necessary to reproduce the problem?
What happens if you remove "-s 720:480" from your command line?
And please provide the output of the following command:
$ ffmpeg -list_formats all -f v4l2 -i /dev/video0

1.I think this is a regression,because I use capture card to grep TV's singal,so when the TV's Advertising is almost white background the problem is happen,but only the white background is error.

2.I only use the libx264,and my OS is Ubuntu server version (not Desktop version,only console),so I can not use the TV software to watch TV(such as "tvtime").
3.I get from the relase "http://ffmpeg.org/releases/ffmpeg-1.2.tar.bz2"
4.Audio is perfet.
5.When I remove "-s 720:480" the video image will be cut.(My output resolution is 640X480,so when I watch the TV,it is like be cut.
6.
Output command

ffmpeg -list_formats all -f v4l2 -i /dev/video0
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar 25 2013 15:32:48 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-version3 --enable-libopencore-amrnb --enable-libopenco                                                                             re-amrwb --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libtheora                                                                              --enable-libvorbis --enable-libx264 --enable-libxvid --enable-gpl --enable-post                                                                             proc --enable-nonfree --enable-network --enable-protocol=tcp --enable-demuxer=rt                                                                             sp --enable-decoder=h264 --enable-zlib
  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
[video4linux2,v4l2 @ 0x1de1be0] Raw       :   yuyv422 :  4:2:2, packed, YUYV :
/dev/video0: Immediate exit requested

in reply to:  2 comment:3 by Carl Eugen Hoyos, 12 years ago

Replying to Ken_JJ:

Replying to cehoyos:

Do you think this is a regression?

1.I think this is a regression,because I use capture card to grep TV's singal,so when the TV's Advertising is almost white background the problem is happen,but only the white background is error.

Allow me to try again:
Does it work with an older version of FFmpeg?
If yes, the problem would be a regression and that would make the ticket important.

Is the problem only reproducible if you use an external library (libx264) or also with a native encoder?

2.I only use the libx264,and my OS is Ubuntu server version (not Desktop version,only console),so I can not use the TV software to watch TV(such as "tvtime").

libx264 is an external library, problems that are only reproducible with external libraries are generally more difficult to fix than issues that are also reproducible without using an external library. FFmpeg should always come with native encoders, please test "-vcodec mpeg4"

Is it reproducible with current git head?

3.I get from the relase "http://ffmpeg.org/releases/ffmpeg-1.2.tar.bz2"

Please test current git head.

Is audio necessary to reproduce the problem?

4.Audio is perfet.

But is audio necessary to reproduce the problem you see, or does the problem also occur if you use "-an"?

What happens if you remove "-s 720:480" from your command line?

5.When I remove "-s 720:480" the video image will be cut.(My output resolution is 640X480,so when I watch the TV,it is like be cut.

I am not sure I understand:
Is your problem (that the image gets gray iiuc) also reproducible if you remove "-s 720:480"? Or does the display only gets gray if you specify a resolution of "-s 720:480" in your command line?

comment:4 by Carl Eugen Hoyos, 12 years ago

Resolution: needs_more_info
Status: newclosed

Please reopen the ticket if you can provide the missing information (especially if "-s 720:480" is responsible for the problem you see).

Note: See TracTickets for help on using tickets.