Как я могу проверить видеофайл из сценария?

Это не работает в Bootstrap Validator (), потому что валидатор включает все входные данные в форме. Это означает, что он проверит поле поиска ввода плагина select2. которая будет мешать проверке множественного выбора

Чтобы исправить это, просто перейдите в validator.js. Добавьте класс поиска ввода select2 .select2-search__field в список игнорирования:

Validator.INPUT_SELECTOR = ':input:not([type="submit"], button, .select2-search__field):enabled:visible'
8
задан Aaron Digulla 21 May 2009 в 20:14
поделиться

5 ответов

It sounds like what you want to do is:

mplayer -vo null -ao null input.file

and then parse the output and return value to see if it could actually play & decode the stream. This will take some time (but be faster than realtime). If you want something even faster, here are some more suggestions:

One easy thing is going to be to do an

mplayer -identify -vo null -ao null

on the file, and then parse the output and look at the return value for something that looks reasonable.

With respect to the checksums being incorrect, it's going to be hard to know if this is an issue for your media player or not (mplayer, vlc, totem, etc.). A good media player will tolerate many bit or byte level errors with little impact on the resulting playback. A very strict media player will exit when it sees malformed or incorrect codec & wrapper bytes.

To verify the wrapper (container) bytes, you could do something like

mencoder -ovc copy -oac copy input.file -o output.file

The problem is that mencoder will want to create an .avi file for output. If your inputs are .avi, then this will work great.

You can run a similar ffmpeg commandline, like this:

ffmpeg -acodec copy -vcodec copy input.file output.file

If the files are .mp4 files, you might want to take a look at mp4box ( http://www.videohelp.com/tools/mp4box ) for doing a similar task. The matroska tools are also good for this kind of thing. ( http://www.matroska.org/ )

6
ответ дан 5 December 2019 в 17:40
поделиться

I recommend you use sha1sum, a command line tool that you probably already have (and if not, you probably also have md5sum, which would be fine for this job)... All you need to do is compare the stdout of sha1sum before and after the restore...

-1
ответ дан 5 December 2019 в 17:40
поделиться

As mplayer has options to convert from one video format to another that might be good enough for such a test assuming mencoder returns an error if it can not decode the input file (I have not tested that). This would work similar to the image test you mentioned (convert image.jpg /tmp/test.png)

1
ответ дан 5 December 2019 в 17:40
поделиться

Если не смотреть все видео, нет "идеального" способа сделать это.

Видео файлы довольно надежны - в качестве эксперимента я взял случайный видеофайл MPEG-4, открыл он в шестнадцатеричном редакторе и начал изменять байты .. mplayer и Quicktime все еще воспроизводили его без ошибок.

Мне пришлось удалить тысячи байтов, прежде чем получить какую-либо ошибку от mplayer:

...
[mpeg4 @ 0x6762b0]marker does not match f_code
[mpeg4 @ 0x6762b0]marker does not match f_code
[mpeg4 @ 0x6762b0]concealing 852 DC, 852 AC, 852 MV errors
[mpeg4 @ 0x6762b0]header damaged:  0.055  16/ 16 15%  1%  3.5% 0 0 
Error while decoding frame!

Это не Нетрудно написать сценарий, который запускает mplayer для каждого видео и проверяет вывод на предмет сообщений об ошибках / предупреждений, но если измененные байты не находятся в заголовке файла или не было изменено много данных, вы никогда не найдете их всех

2
ответ дан 5 December 2019 в 17:40
поделиться

Если вы работаете с файлами MP4, возможно, вы захотите взглянуть на проект mpeg4ip , в частности на такие инструменты, как mp4videoinfo или mp4info . Этого может быть достаточно для удовлетворения ваших потребностей, и это очень быстро.

С первой страницы:

  • mp4dump Утилита для дампа метаинформации файла MP4 в текстовой форме
  • mp4trackdump Утилита для дампа информации о дорожке файла MP4 в текстовой форме
  • mp4info Утилита для отображения сводки файла MP4
  • mp4videoinfo Утилита для вывода информации о видеодорожках в файл MP4
  • avidump Утилита для отображения сводки по AVI-файлу
  • yuvdump Утилита для отображения необработанного видеофайла на экране
  • mpeg_ps_info Утилита для отображения потоков в потоке программы mpeg или файле vob
  • mpeg_ps_extract Утилита для извлечения элементарных потоков в потоке программы mpeg или файле vob

Вот пример вывода MP4, снятого на моем Nokia N95:

manoa:Movies stu$ mp4info 20081017001.mp4 
mp4info version 1.5.0.1
20081017001.mp4:
Track   Type    Info
1   video   MPEG-4 Unknown Profile(4), 3.620 secs, 2700 kbps, 640x480 @ 23.480663 fps
2   audio   MPEG-4 AAC LC, 3.797 secs, 97 kbps, 48000 Hz
manoa:Movies stu$ 
manoa:Movies stu$ 
manoa:Movies stu$ mp4videoinfo 20081017001.mp4
mp4videoinfo version 1.5.0.1
tracks 1
mp4file 20081017001.mp4, track 1, samples 85, timescale 30000
sampleId      1, size 24110 time 0(0) VOP-I
sampleId      2, size  9306 time 4076(135) VOP-P
sampleId      3, size 13071 time 5104(170) VOP-P
... (a bunch more frames and a bit of info)  ...
sampleId     59, size  8702 time 64975(2165) VOP-P
sampleId     60, size  8826 time 65980(2199) VOP-P
sampleId     61, size  9819 time 66966(2232) GOV VOP-I
sampleId     62, size  5591 time 67986(2266) VOP-P
... (a bunch more frames and a bit of info)  ...
sampleId     83, size 10188 time 105546(3518) VOP-P
sampleId     84, size  6533 time 106585(3552) VOP-P
sampleId     85, size  6032 time 107601(3586) VOP-P
manoa:Movies stu$
2
ответ дан 5 December 2019 в 17:40
поделиться
Другие вопросы по тегам:

Похожие вопросы: