[FFmpeg-user] Remove two lines from the bottom of the video

Wesley Wen delbin.wen at gmail.com
Mon Feb 2 11:51:12 CET 2015


Hi,

We have some assets that were digitized from analog programs. In some video
there are 1-2 green lines can be seen at the bottom of the video. Could you
give me some idea how to remove them?

I'm thinking to crop the original one, but the result aspect ratio is quite
strange.

Here is the probe result of the original file.
ffprobe sample.mpg
ffprobe version git-2014-12-19-c89751a Copyright (c) 2007-2014 the FFmpeg
developers
  built on Dec 19 2014 17:29:41 with Apple LLVM version 6.0
(clang-600.0.56) (based on LLVM 3.5svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared
--enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang --host-cflags= --host-ldflags=
--enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
--enable-libvo-aacenc --enable-ffplay --enable-libfdk-aac --enable-libx265
--enable-nonfree --enable-vda
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 16.100 / 56. 16.100
  libavformat    56. 16.101 / 56. 16.101
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  4.100 /  5.  4.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpeg, from 'sample.mpg':
  Duration: 00:24:28.18, start: 0.262000, bitrate: 8597 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR
8:9 DAR 4:3], 8000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s

And here is the command I used to do crop.
ffmpeg -y -i sample.mpg -c:v libx264 -b:v 80k -vf
crop=720:438:0:0,scale=426:240 out.mp4
ffmpeg version git-2014-12-19-c89751a Copyright (c) 2000-2014 the FFmpeg
developers
  built on Dec 19 2014 17:29:41 with Apple LLVM version 6.0
(clang-600.0.56) (based on LLVM 3.5svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared
--enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang --host-cflags= --host-ldflags=
--enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
--enable-libvo-aacenc --enable-ffplay --enable-libfdk-aac --enable-libx265
--enable-nonfree --enable-vda
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 16.100 / 56. 16.100
  libavformat    56. 16.101 / 56. 16.101
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  4.100 /  5.  4.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpeg, from 'sample.mpg':
  Duration: 00:24:28.18, start: 0.262000, bitrate: 8597 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR
8:9 DAR 4:3], 8000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s
[libx264 @ 0x7fd16c1c8600] using SAR=149/181
[libx264 @ 0x7fd16c1c8600] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x7fd16c1c8600] profile High, level 2.1
[libx264 @ 0x7fd16c1c8600] 264 - core 142 r2455 021c0dc - H.264/MPEG-4 AVC
codec - Copyleft 2003-2014 - 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=6
lookahead_threads=1 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=80
ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf56.16.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p,
426x240 [SAR 12800:15549 DAR 320:219], q=-1--1, 80 kb/s, 29.97 fps, 30k
tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.16.100 libx264
    Stream #0:1: Audio: aac (libfaac) ([64][0][0][0] / 0x0040), 48000 Hz,
stereo, s16, 128 kb/s
    Metadata:
      encoder         : Lavc56.16.100 libfaac
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (mp2 (native) -> aac (libfaac))
Press [q] to stop, [?] for help
frame=44001 fps=259 q=-1.0 Lsize=   38979kB time=00:24:28.18 bitrate=
217.5kbits/s
video:14504kB audio:22936kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 4.110849%
[libx264 @ 0x7fd16c1c8600] frame I:595   Avg QP:35.39  size:  2167
[libx264 @ 0x7fd16c1c8600] frame P:22808 Avg QP:38.96  size:   486
[libx264 @ 0x7fd16c1c8600] frame B:20598 Avg QP:40.43  size:   120
[libx264 @ 0x7fd16c1c8600] consecutive B-frames: 17.8% 54.1% 15.7% 12.4%
[libx264 @ 0x7fd16c1c8600] mb I  I16..4: 24.4% 68.1%  7.6%
[libx264 @ 0x7fd16c1c8600] mb P  I16..4:  1.8%  3.8%  0.1%  P16..4: 30.4%
 3.4%  1.3%  0.0%  0.0%    skip:59.3%
[libx264 @ 0x7fd16c1c8600] mb B  I16..4:  0.0%  0.1%  0.0%  B16..8: 21.6%
 0.4%  0.0%  direct: 0.1%  skip:77.8%  L0:33.5% L1:65.8% BI: 0.7%
[libx264 @ 0x7fd16c1c8600] final ratefactor: 35.04
[libx264 @ 0x7fd16c1c8600] 8x8 transform intra:66.3% inter:88.7%
[libx264 @ 0x7fd16c1c8600] coded y,uvDC,uvAC intra: 27.6% 33.9% 4.7% inter:
3.2% 2.7% 0.0%
[libx264 @ 0x7fd16c1c8600] i16 v,h,dc,p: 28% 35% 10% 27%
[libx264 @ 0x7fd16c1c8600] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 16% 35%  5%
 6%  5%  7%  5%  6%
[libx264 @ 0x7fd16c1c8600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 22% 20%  6%
 8%  6%  8%  4%  5%
[libx264 @ 0x7fd16c1c8600] i8c dc,h,v,p: 83% 10%  6%  1%
[libx264 @ 0x7fd16c1c8600] Weighted P-Frames: Y:19.3% UV:7.4%
[libx264 @ 0x7fd16c1c8600] ref P L0: 65.1% 13.1% 14.7%  5.9%  1.2%
[libx264 @ 0x7fd16c1c8600] ref B L0: 88.2% 10.9%  0.9%
[libx264 @ 0x7fd16c1c8600] ref B L1: 98.2%  1.8%
[libx264 @ 0x7fd16c1c8600] kb/s:80.93

And the result looks like below:
ffprobe out.mp4
ffprobe version git-2014-12-19-c89751a Copyright (c) 2007-2014 the FFmpeg
developers
  built on Dec 19 2014 17:29:41 with Apple LLVM version 6.0
(clang-600.0.56) (based on LLVM 3.5svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared
--enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang --host-cflags= --host-ldflags=
--enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
--enable-libvo-aacenc --enable-ffplay --enable-libfdk-aac --enable-libx265
--enable-nonfree --enable-vda
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 16.100 / 56. 16.100
  libavformat    56. 16.101 / 56. 16.101
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  4.100 /  5.  4.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.16.101
  Duration: 00:24:28.20, start: 0.021333, bitrate: 217 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
426x240 [SAR 149:181 DAR 10579:7240], 80 kb/s, SAR 12800:15549 DAR 320:219,
29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

I'd like to keep display aspect ratio as 4:3, and remove those two green
lines or fill black.

Thanks,
Wesley


More information about the ffmpeg-user mailing list