AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1217238
Accepted
Sybil
Sybil
Asked: 2020-03-15 22:23:16 +0800 CST2020-03-15 22:23:16 +0800 CST 2020-03-15 22:23:16 +0800 CST

如何在命令行 VR 视频中识别?..并批量删除它们

  • 772

有时我不小心下载了 VR(虚拟现实)视频。我无法在我的 Linux 机器上观看 VR 视频(即使在 macOS 上也无法正常工作)。

如何识别 VR 视频(mediainfo或类似工具)并将其删除到类似的文件夹中/torrents/complete?

这里示例视频元数据:

$ mediainfo example.mp4
General
Complete name                            : example.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 83.1 MiB
Duration                                 : 9 min 40 s
Overall bit rate                         : 1 201 kb/s
Writing application                      : Lavf58.0.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 9 min 40 s
Bit rate                                 : 1 067 kb/s
Width                                    : 1 440 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 2.000
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.041
Stream size                              : 73.8 MiB (89%)
Writing library                          : x264 core 152 r19 ba24899
Encoding settings                        : cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x3:0x3 / me=dia / subme=1 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=12 / lookahead_threads=2 / 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=1 / keyint=125 / keyint_min=12 / scenecut=0 / intra_refresh=0 / rc=crf / mbtree=0 / crf=26.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / pb_ratio=1.30 / aq=1:1.00
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 9 min 40 s
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 6 channels
Channel layout                           : C L R Ls Rs LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 8.86 MiB (11%)
Default                                  : Yes
Alternate group                          : 1

谢谢:

我用了

find . -type f -name '[^.]*.mp4' -exec bash -c 'ratio=$(ffprobe -loglevel error -select_streams v:0 -show_entries stream=display_aspect_ratio -of csv=p=0 "$1"); if [[ "$ratio" == 2:1 ]]; then echo "$1"; fi' _ {} \;

似乎rtorrent创建了点文件。

我只去一个误报输出:

mediainfo xxx.mp4
General
Complete name                            : xxx.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 613 MiB
Duration                                 : 27 min 38 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 3 099 kb/s
Encoded date                             : UTC 2013-06-12 05:00:00
Tagged date                              : UTC 2013-06-12 05:00:00
Writing application                      : Lavf53.6.0

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 27 min 38 s
Bit rate                                 : 3 000 kb/s
Width                                    : 640 pixels
Height                                   : 320 pixels
Display aspect ratio                     : 2.000
Frame rate mode                          : Constant
Frame rate                               : 24.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.610
Stream size                              : 590 MiB (96%)
Writing library                          : x264 core 116
Encoding settings                        : 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=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=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=3000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Language                                 : English
Encoded date                             : UTC 2013-06-12 05:00:00
Tagged date                              : UTC 2013-06-12 05:00:00
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 27 min 38 s
Bit rate mode                            : Variable
Bit rate                                 : 107 kb/s
Maximum bit rate                         : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 21.1 MiB (3%)
Language                                 : English
Encoded date                             : UTC 2013-06-12 05:00:00
Tagged date                              : UTC 2013-06-12 05:00:00
scripts command-line video ffmpeg
  • 1 1 个回答
  • 206 Views

1 个回答

  • Voted
  1. Best Answer
    llogan
    2020-03-17T14:10:20+08:002020-03-17T14:10:20+08:00

    根据您提供的信息,没有万无一失的方法,因为没有列出任何 VR 视频独有的内容。

    但是,也许您可​​以假设任何具有 2:1 显示纵横比的视频都可能是 VR:

    #!/bin/bash
    cd "/torrents/complete" || exit
    for f in *.mp4; do
    ratio=$(ffprobe -loglevel error -select_streams v:0 -show_entries stream=display_aspect_ratio -of csv=p=0 "$f")
    if [ "$ratio" = 2:1 ]
    then
      echo "$f"
    fi
    done
    

    上面的脚本将简单地打印要删除的文件的名称。如果这些匹配正确,您可以更改echo "$f"为rm -f "$f".

    或使用递归版本find:

    cd "/torrents/complete"
    find . -type f -name '*.mp4' -exec bash -c 'ratio=$(ffprobe -loglevel error -select_streams v:0 -show_entries stream=display_aspect_ratio -of csv=p=0 "$1"); if [[ "$ratio" == 2:1 ]]; then echo "$1"; fi' _ {} \;
    

    上面的命令将简单地打印要删除的文件的名称。如果这些匹配正确,您可以更改echo "$1"为rm -f "$1".

    • 2

相关问题

  • 如何从命令行刻录双层 dvd iso

  • 如何从命令行判断机器是否需要重新启动?

  • Ubuntu 和交互式媒体安装

  • 文件权限如何工作?文件权限用户和组

  • 如何在 Vim 中启用全彩支持?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve