From 067d770e4b0088cc06dbecf7b36f0fed18e8f09f Mon Sep 17 00:00:00 2001 From: Farshid PirahanSiah <pirahansiah@gmail.com> Date: Thu, 12 Nov 2020 20:04:53 +0100 Subject: [PATCH] fix extract_all.sh and add new script to extract all videos in one run --- README.md | 11 +++++++++++ extract_all.sh | 8 ++++++-- extract_all_videos_files.sh | 9 +++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 extract_all_videos_files.sh diff --git a/README.md b/README.md index 2f952c5..1b385e0 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,17 @@ Otherwise, just install the requirements on your main Python environment using ` pip install -r requirements ``` +Extract all frames from video files. +You can copy all your videos to the `data` folder and run the scrip to extract all videos in the folder by using +``` +sh extract_all_videos_files.sh +``` +or you can use the below script to extract one file +``` +sh extract_all.sh data/video_file.MOV +``` + + Finally, open the GUI using: ```bash python -m ultimatelabeling.main diff --git a/extract_all.sh b/extract_all.sh index 1cd816f..6402cc0 100644 --- a/extract_all.sh +++ b/extract_all.sh @@ -1,4 +1,8 @@ #!/bin/sh -mkdir $2 -ffmpeg -i $1 -vf "select=not(mod(n\,5))" -vsync vfr -qscale:v 2 -start_number 0 $2/%05d.jpg +input_path=$1 +output_path=${input_path%.*} + +mkdir $output_path +echo $output_path +ffmpeg -i $1 -vf "select=not(mod(n\,5))" -vsync vfr -qscale:v 2 -start_number 0 $output_path/%05d.jpg diff --git a/extract_all_videos_files.sh b/extract_all_videos_files.sh new file mode 100644 index 0000000..7d57f98 --- /dev/null +++ b/extract_all_videos_files.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +for filename in data/*.MOV; do + input_path=$filename + output_path1=${input_path%.*} + echo "$output_path1" + mkdir $output_path1 + ffmpeg -i $input_path -vf "select=not(mod(n\,5))" -vsync vfr -qscale:v 2 -start_number 0 "$output_path1"/%05d.jpg +done