Иногда я случайно загружаю видеоролики VR (виртуальная реальность). Я не могу просматривать видеоролики VR на своем компьютере с Linux (даже на 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 : High@L3.2
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
На основе предоставленной вами информации нет надежного способа, потому что в списке нет ничего уникального для 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"
.