使用 ffmpeg 缩小 Android 纵向视频后没有缩略图或属性

使用 ffmpeg 缩小 Android 纵向视频后没有缩略图或属性

我使用运行 Android Lollipop 的 Nexus 5 拍摄了许多 1080p 视频。我使用 ffmpeg v3.1.5 将它们缩小到 720p(在有人指出这一点之前,我已经将视频录制质量设置为 720p)。其中一些是纵向的。我对这些视频使用了以下命令:

ffmpeg -i VID_20150919_121521.mp4 -vf scale=720:-1 VID_20150919_121521-2.mp4

我很高兴让 ffmpeg 完成它的工作。我对结果很满意。但是,我很惊讶地发现我不需要使用转置选项。正如您在下面的输出中看到的,似乎有一些旋转元数据。我不知道这是否相关,只是把它放在那里。现在这在技术上是可行的 - 视频缩放到 720p 并以正确的方向在 VLC 中播放,但没有 Windows 7 资源管理器缩略图,并且在属性详细信息中没有帧宽度和高度或帧速率信息。我所有其他横向视频都可以很好地缩小尺寸,我得到了缩略图和帧信息。发生了什么,我该如何解决它?

ffmpeg version 3.1.5 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'VID_20150919_121521.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2015-09-19 16:15:29
    location        : +45.4699-075.5184/
    location-eng    : +45.4699-075.5184/
  Duration: 00:00:06.53, start: 0.000000, bitrate: 12568 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080, 12217 kb/s, SAR 1:1 DAR 16:9, 30.32 fps, 30 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2015-09-19 16:15:29
      handler_name    : VideoHandle
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 96 kb/s (default)
    Metadata:
      creation_time   : 2015-09-19 16:15:29
      handler_name    : SoundHandle
[libx264 @ 0000000002d7fa80] using SAR=1/1
[libx264 @ 0000000002d7fa80] using cpu capabilities: MMX2 SSE2Fast LZCNT
[libx264 @ 0000000002d7fa80] profile High, level 3.1
[libx264 @ 0000000002d7fa80] 264 - core 148 r2721 72d53ab - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=4 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=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 00000000005ef4e0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'VID_20150919_121521-2.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    location-eng    : +45.4699-075.5184/
    location        : +45.4699-075.5184/
    encoder         : Lavf57.41.100
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x1280 [SAR 1:1 DAR 9:16], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandle
      creation_time   : 2015-09-19 16:15:29
      encoder         : Lavc57.48.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, mono, fltp, 69 kb/s (default)
    Metadata:
      creation_time   : 2015-09-19 16:15:29
      handler_name    : SoundHandle
      encoder         : Lavc57.48.101 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame=   30 fps=0.0 q=0.0 size=       0kB time=00:00:01.06 bitrate=   0.4kbits/s speed=2.13x    
frame=   47 fps= 37 q=0.0 size=       0kB time=00:00:02.00 bitrate=   0.2kbits/s speed=1.59x    
frame=   55 fps= 31 q=29.0 size=     142kB time=00:00:02.00 bitrate= 580.1kbits/s speed=1.11x    
Past duration 0.608986 too large
frame=   63 fps= 26 q=29.0 size=     289kB time=00:00:03.00 bitrate= 788.3kbits/s speed=1.24x    
Past duration 0.619331 too large
Past duration 0.629662 too large
Past duration 0.639992 too large
Past duration 0.650322 too large
Past duration 0.660652 too large
Past duration 0.674324 too large
Past duration 0.684654 too large
Past duration 0.695000 too large
frame=   71 fps= 22 q=29.0 size=     482kB time=00:00:03.00 bitrate=1312.7kbits/s speed=0.951x    
Past duration 0.701653 too large
Past duration 0.714653 too large
Past duration 0.727654 too large
Past duration 0.736992 too large
Past duration 0.746330 too large
Past duration 0.755653 too large
Past duration 0.764992 too large
Past duration 0.782661 too large
frame=   79 fps= 21 q=29.0 size=     651kB time=00:00:03.00 bitrate=1772.3kbits/s speed=0.797x    
Past duration 0.790993 too large
Past duration 0.804665 too large
Past duration 0.811333 too large
Past duration 0.823326 too large
Past duration 0.835320 too large
Past duration 0.832985 too large
Past duration 0.857658 too large
frame=   86 fps= 20 q=29.0 size=     786kB time=00:00:03.00 bitrate=2141.7kbits/s speed=0.696x    
Past duration 0.865990 too large
Past duration 0.878990 too large
Past duration 0.885658 too large
Past duration 0.898659 too large
Past duration 0.911659 too large
Past duration 0.924660 too large
frame=   92 fps= 19 q=29.0 size=     900kB time=00:00:03.00 bitrate=2452.0kbits/s speed=0.62x    
Past duration 0.931999 too large
Past duration 0.939323 too large
Past duration 0.952660 too large
Past duration 0.965996 too large
Past duration 0.979332 too large
Past duration 0.988655 too large
Past duration 0.997993 too large
frame=  100 fps= 18 q=29.0 size=    1055kB time=00:00:04.01 bitrate=2154.8kbits/s speed=0.735x    
frame=  107 fps= 18 q=29.0 size=    1186kB time=00:00:04.01 bitrate=2421.8kbits/s speed=0.665x    
frame=  115 fps= 17 q=29.0 size=    1325kB time=00:00:04.01 bitrate=2707.1kbits/s speed=0.594x    
frame=  123 fps= 17 q=29.0 size=    1458kB time=00:00:04.01 bitrate=2979.0kbits/s speed=0.545x    
frame=  130 fps= 17 q=29.0 size=    1587kB time=00:00:05.01 bitrate=2592.5kbits/s speed=0.637x    
frame=  135 fps= 16 q=29.0 size=    1676kB time=00:00:05.01 bitrate=2738.8kbits/s speed=0.597x    
frame=  143 fps= 16 q=29.0 size=    1828kB time=00:00:05.01 bitrate=2986.4kbits/s speed=0.552x    
frame=  150 fps= 16 q=29.0 size=    1963kB time=00:00:05.01 bitrate=3207.7kbits/s speed=0.523x    
frame=  156 fps= 15 q=29.0 size=    2055kB time=00:00:06.01 bitrate=2799.0kbits/s speed=0.594x    
frame=  163 fps= 15 q=29.0 size=    2208kB time=00:00:06.01 bitrate=3006.9kbits/s speed=0.561x    
frame=  171 fps= 15 q=29.0 size=    2373kB time=00:00:06.01 bitrate=3230.9kbits/s speed=0.525x    
frame=  179 fps= 15 q=29.0 size=    2518kB time=00:00:06.01 bitrate=3428.5kbits/s speed=0.494x    
frame=  185 fps= 15 q=29.0 size=    2631kB time=00:00:06.01 bitrate=3583.0kbits/s speed=0.475x    
frame=  191 fps= 14 q=29.0 size=    2738kB time=00:00:06.03 bitrate=3715.2kbits/s speed=0.456x    
frame=  194 fps= 12 q=-1.0 Lsize=    3555kB time=00:00:06.52 bitrate=4461.1kbits/s speed=0.398x    
video:3490kB audio:56kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.233024%
[libx264 @ 0000000002d7fa80] frame I:3     Avg QP:23.00  size: 34556
[libx264 @ 0000000002d7fa80] frame P:50    Avg QP:25.33  size: 30594
[libx264 @ 0000000002d7fa80] frame B:141   Avg QP:26.77  size: 13760
[libx264 @ 0000000002d7fa80] consecutive B-frames:  1.5%  3.1%  4.6% 90.7%
[libx264 @ 0000000002d7fa80] mb I  I16..4: 11.0% 81.3%  7.7%
[libx264 @ 0000000002d7fa80] mb P  I16..4:  6.7% 40.0%  3.5%  P16..4: 33.6% 10.1%  4.3%  0.0%  0.0%    skip: 1.7%
[libx264 @ 0000000002d7fa80] mb B  I16..4:  1.3%  4.3%  0.2%  B16..8: 45.2%  8.6%  1.3%  direct:12.7%  skip:26.5%  L0:47.3% L1:47.7% BI: 5.0%
[libx264 @ 0000000002d7fa80] 8x8 transform intra:78.6% inter:77.3%
[libx264 @ 0000000002d7fa80] coded y,uvDC,uvAC intra: 61.0% 86.1% 49.6% inter: 28.9% 48.0% 5.4%
[libx264 @ 0000000002d7fa80] i16 v,h,dc,p: 19% 16%  8% 57%
[libx264 @ 0000000002d7fa80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 17% 21%  6%  7%  7%  8%  7% 10%
[libx264 @ 0000000002d7fa80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 23% 17%  6%  8%  6%  7%  5%  6%
[libx264 @ 0000000002d7fa80] i8c dc,h,v,p: 57% 18% 18%  7%
[libx264 @ 0000000002d7fa80] Weighted P-Frames: Y:4.0% UV:2.0%
[libx264 @ 0000000002d7fa80] ref P L0: 65.2% 12.5% 16.0%  6.1%  0.1%
[libx264 @ 0000000002d7fa80] ref B L0: 93.7%  5.1%  1.2%
[libx264 @ 0000000002d7fa80] ref B L1: 98.2%  1.8%
[libx264 @ 0000000002d7fa80] kb/s:4420.90
[aac @ 0000000000531400] Qavg: 673.912

答案1

然而,我从来没有弄清楚这一点,鉴于我最近尝试的所有播放器都读取了旋转元数据并正确显示视频,使用-noautorotate@LordNeckbeard 建议的选项效果很好。此外,我还发现了一款​​名为 Icaros 的 Windows 资源管理器缩略图和详细信息提供程序应用程序,它非常适合 MKV 和其他非本地支持的文件类型。

相关内容