Bash shell, call FFmpeg periodic screenshot

Source: Internet
Author: User

#!/bin/bash# gets all m3u8 files in the current directory, and Var=$(ls|grep '. m3u8'|Cut-D'.'-F1) #死循环 while[1=1 ] Do#循环每个文件 forStreaminch$var Do#获取当前最新视频文件 TS=$(ls-t|grep "$stream")         for file inch$ts Do#存储M3U8文件文件名作为图片文件名, for* -, capturing the first frame, stored in the current directory of the Screen folder img=$(ls$file|Cut-D'-'-F1) #调用ffmpeg intercept video FFMPEG2-I. $file-y-f image2-s -* --vframes1screen/$img. png #跳出循环break Done     Done#延迟1分钟Sleep1m Done

Live directory Files

Drwxrwxr-x4Yusen Yusen4096AugustTen  -: -. drwxrwxrwx -Root root4096AugustTen  -: - ..-rw-rw-r--1Yusen Yusen1241740August4  -: - 471132-Ten. TS-rw-rw-r--1Yusen Yusen1237228August4  -: - 471132- One. TS-rw-rw-r--1Yusen Yusen1256404August4  -: - 471132- A. TS-rw-rw-r--1Yusen Yusen598028August4  -: - 471132- -. TS-rw-rw-r--1Yusen Yusen1242304August4  -: - 471132-9. TS-rw-rw-r--1Yusen Yusen229August4  -: - 471132. m3u8-rw-rw-r--1Yusen Yusen530912August8  -: , 6598-0. TS-rw-rw-r--1Yusen Yusen665332August8  -: , 6598-1. TS-rw-rw-r--1Yusen Yusen654616August8  -: , 6598-2. TS-rw-rw-r--1Yusen Yusen719100August8  -: the 6598-3. TS-rw-rw-r--1Yusen Yusen321668August8  -: the 6598-4. TS-rw-rw-r--1Yusen Yusen669468August7 Ten: + 6598-5. TS-rw-rw-r--1Yusen Yusen648788August7 Ten: + 6598-6. TS-rw-rw-r--1Yusen Yusen162620August7 Ten: - 6598-7. TS-rw-rw-r--1Yusen Yusen325August8  -: the 6598. M3U8DRWXRWXR-X2Yusen Yusen4096AugustTen  ,: WuDEMODRWXRWXR-X2Yusen Yusen4096AugustTen  A:xx Screen-rwxrwxr-x1Yusen Yusen520AugustTen  -: -Screen.SH-rwxrwxr-x1Yusen Yusen520AugustTen  -: onScreen.SH~
Drwxrwxr-x4Yusen Yusen4096AugustTen  -: -. drwxrwxrwx -Root root4096AugustTen  -: - ..-rw-rw-r--1Yusen Yusen1241740August4  -: - 471132-Ten. TS-rw-rw-r--1Yusen Yusen1237228August4  -: - 471132- One. TS-rw-rw-r--1Yusen Yusen1256404August4  -: - 471132- A. TS-rw-rw-r--1Yusen Yusen598028August4  -: - 471132- -. TS-rw-rw-r--1Yusen Yusen1242304August4  -: - 471132-9. TS-rw-rw-r--1Yusen Yusen229August4  -: - 471132. m3u8-rw-rw-r--1Yusen Yusen530912August8  -: , 6598-0. TS-rw-rw-r--1Yusen Yusen665332August8  -: , 6598-1. TS-rw-rw-r--1Yusen Yusen654616August8  -: , 6598-2. TS-rw-rw-r--1Yusen Yusen719100August8  -: the 6598-3. TS-rw-rw-r--1Yusen Yusen321668August8  -: the 6598-4. TS-rw-rw-r--1Yusen Yusen669468August7 Ten: + 6598-5. TS-rw-rw-r--1Yusen Yusen648788August7 Ten: + 6598-6. TS-rw-rw-r--1Yusen Yusen162620August7 Ten: - 6598-7. TS-rw-rw-r--1Yusen Yusen325August8  -: the 6598. M3U8DRWXRWXR-X2Yusen Yusen4096AugustTen  ,: WuDEMODRWXRWXR-X2Yusen Yusen4096AugustTen  A:xx Screen-rwxrwxr-x1Yusen Yusen520AugustTen  -: -Screen.SH-rwxrwxr-x1Yusen Yusen520AugustTen  -: onScreen.SH~

Screen.sh for a shell that needs to be executed
Screen for the stored directory, execute the shell after the file in the screen directory is

Drwxrwxr-x2Yusen Yusen4096AugustTen  A:xx. DRWXRWXR-X4Yusen Yusen4096AugustTen  -: - ..-rw-rw-r--1Yusen Yusen58497AugustTen  A:xx 471132. PNG-rw-rw-r--1Yusen Yusen29596AugustTen  A:xx 6598. png

You can see that the automatic acquisition of the video has been realized, need to modify the interception cycle only need to modify the sleep parameters.

Bash shell, call FFmpeg periodic

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.