/useful/trunk-1

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/useful/trunk-1

« back to all changes in this revision

Viewing changes to scripts/enc2firefox.sh

  • Committer: Gustav Hartvigsson
  • Date: 2024-11-02 21:19:08 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20241102211908-ad9nwyj2sf3mpepv
* That's awkard...

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env bash
2
 
###################
 
2
####
3
3
# FILE NAME: enc2firefox.sh
4
4
#
 
5
# Authors:
 
6
#    Gustav Hartvigsson 2024
 
7
#    Distributed under the Cool Licence 1.1
 
8
#
5
9
# Encodes (mp4/x264) videos so they can be played in firefox.
6
10
#
7
11
# Updates:
12
16
# 2021-01-13:
13
17
#   * Fixed up if statments
14
18
#
15
 
####################
16
 
ARGS=()
17
 
ARGS="${@}"
 
19
# 2024-07-10
 
20
#  * Simplefied if-else-statement.
 
21
#
 
22
####
18
23
 
19
 
__IN_NAME=
20
 
__OUT_NAME=
 
24
__IN_NAME=""
 
25
__OUT_NAME=""
21
26
__USE_WEBM=false
22
27
__USE_FJ=false
23
28
 
24
 
__help () {
 
29
__usage () {
25
30
  echo "enc2firefox.sh -- Make Videos Playable in Firefox"
26
31
  echo " "
27
32
  echo "-i <input video file>     Input Video File."
102
107
      shift
103
108
      ;;
104
109
      -h|--help)
105
 
      __help
 
110
      __usage
106
111
      shift
107
112
      ;;
108
113
      *)
109
 
      __help
 
114
      __usage
110
115
      exit 1
111
116
      shift
112
117
      ;;
119
124
}
120
125
 
121
126
__main () {
122
 
  if [[ ! -e "$__IN_NAME" ]]
123
 
  then
 
127
  if [[ ! -e "$__IN_NAME" ]]; then
124
128
    echo "missing input audio. Please provide."
125
129
    exit 1
126
130
  fi
127
131
  
128
 
  if [[ $__OUT_NAME == "" ]]
129
 
  then
 
132
  if [[ $__OUT_NAME == "" ]]; then
130
133
    echo "missing output file name. Please provide."
131
134
    exit 1
132
135
  fi
133
 
  
134
 
  
135
 
  if [[ $__USE_WEBM == true ]]
136
 
  then
137
 
    if [[ $__IN_NAME == $__OUT_NAME.webm ]]
138
 
    then
 
136
 
 
137
  if [[ $__USE_WEBM == true ]]; then
 
138
    if [[ $__IN_NAME == $__OUT_NAME.webm ]]; then
139
139
      echo "Filenames can't be the same."
140
140
      exit
141
141
    fi
142
142
    __enc_webm
143
 
  elif [[ $__USE_FJ == true ]]
144
 
  then
145
 
    if [[ $__IN_NAME == $__OUT_NAME.mp4 ]]
146
 
    then
147
 
      echo "Filenames can't be the same."
148
 
      exit
 
143
  elif [[ $__IN_NAME == $__OUT_NAME.mp4 ]]; then
 
144
    if [[ $__USE_FJ == true ]]; then
 
145
      __enc_fj
 
146
    else
 
147
      __enc_mp4
149
148
    fi
150
 
    __enc_fj
151
149
  else
152
 
    if [[ $__IN_NAME == $__OUT_NAME.mp4 ]]
153
 
    then
154
 
      echo "Filenames can't be the same."
155
 
      exit
156
 
    fi
157
 
    __enc_mp4
 
150
    echo " Input and output files can't be the same."
 
151
    exit
158
152
  fi
159
153
}
160
154