<commit_before>#!/usr/bin/env bash

# Test script for gear360video.sh
# Note: the single test times might not sum-up to total test time
#       because creating test videos also takes time

#############
### Constants

# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-which-directory-it-is-stored-in
DIR=$(dirname `which $0`)
T="./gear360video.sh" # T - for simplicity, it's a test subject
# Debug, yes = print debug messages
DEBUG="no"
VERSION="5"

#############
### Functions

# Debug, arguments:
# 1. Text to print
print_debug() {
  if [ "$DEBUG" == "yes" ]; then
    echo "DEBUG: $@"
  fi
}

# Create test video
# Arguments:
# 1 - video size (in pixels, optional)
# 2 - duration (in seconds, optional)
# 3 - frame rate (fps, optional)
# 4 - no sound (0 - sound /default/, 1 - no sound)
# Returns:
# test file full path
create_test_video() {
  local videoformat="mp4" # hardcoded for the moment
  # Default parameter: https://stackoverflow.com/questions/9332802/how-to-write-a-bash-script-that-takes-optional-input-arguments
  local videosize=${1:-"3840x1920"} # Other video size: 4096x2048, 2560x1280
  local duration=${2:-"1"}
  local framerate=${3:-"29.97"}
  local nosound=${4:-"0"}
  local filename=$(mktemp --suffix=.${videoformat}) # Mind the dot (extension)

  print_debug "create_test_video args: size: ${videosize}, duration: ${duration}, fps: ${framerate}, nosound: ${nosound}, out filename: ${filename}"

  # Well... we assume it will not fail
  local soundopt=""
  if [ ${nosound} -eq 0 ]; then
    soundopt="-f lavfi -i sine=frequency=1000:sample_rate=48000:duration=${duration}"
  fi
  ffmpeg -loglevel quiet -y -f lavfi -i testsrc=duration=${duration}:size=${videosize}:rate=30 ${soundopt} -f ${videoformat} ${filename}
<commit_msg>Add framerate to test video<commit_after>#!/usr/bin/env bash

# Test script for gear360video.sh
# Note: the single test times might not sum-up to total test time
#       because creating test videos also takes time

#############
### Constants

# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-which-directory-it-is-stored-in
DIR=$(dirname `which $0`)
T="./gear360video.sh" # T - for simplicity, it's a test subject
# Debug, yes = print debug messages
DEBUG="no"
VERSION="5"

#############
### Functions

# Debug, arguments:
# 1. Text to print
print_debug() {
  if [ "$DEBUG" == "yes" ]; then
    echo "DEBUG: $@"
  fi
}

# Create test video
# Arguments:
# 1 - video size (in pixels, optional)
# 2 - duration (in seconds, optional)
# 3 - frame rate (fps, optional)
# 4 - no sound (0 - sound /default/, 1 - no sound)
# Returns:
# test file full path
create_test_video() {
  local videoformat="mp4" # hardcoded for the moment
  # Default parameter: https://stackoverflow.com/questions/9332802/how-to-write-a-bash-script-that-takes-optional-input-arguments
  local videosize=${1:-"3840x1920"} # Other video size: 4096x2048, 2560x1280
  local duration=${2:-"1"}
  local framerate=${3:-"29.97"}
  local nosound=${4:-"0"}
  local filename=$(mktemp --suffix=.${videoformat}) # Mind the dot (extension)

  print_debug "create_test_video args: size: ${videosize}, duration: ${duration}, fps: ${framerate}, nosound: ${nosound}, out filename: ${filename}"

  # Well... we assume it will not fail
  local soundopt=""
  if [ ${nosound} -eq 0 ]; then
    soundopt="-f lavfi -i sine=frequency=1000:sample_rate=48000:duration=${duration}"
  fi
  ffmpeg -loglevel quiet -y -f lavfi -i testsrc=duration=${duration}:size=${videosize}:rate=${framerate} ${soundopt} -f ${videoformat} ${filename}

{'fraction_non_alphanumeric': 0.1699438202247191, 'fraction_numerical': 0.04101123595505618, 'mean_word_length': 4.322869955156951, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5291647', 'n_tokens_mistral': 1293, 'n_tokens_neox': 1164, 'n_words': 342}