/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:
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
#
 
19
# 2024-07-10
 
20
#  * Simplefied if-else-statement.
 
21
#
15
22
####
16
23
 
17
 
__IN_NAME=
18
 
__OUT_NAME=
 
24
__IN_NAME=""
 
25
__OUT_NAME=""
19
26
__USE_WEBM=false
20
27
__USE_FJ=false
21
28
 
22
 
__help () {
 
29
__usage () {
23
30
  echo "enc2firefox.sh -- Make Videos Playable in Firefox"
24
31
  echo " "
25
32
  echo "-i <input video file>     Input Video File."
100
107
      shift
101
108
      ;;
102
109
      -h|--help)
103
 
      __help
 
110
      __usage
104
111
      shift
105
112
      ;;
106
113
      *)
107
 
      __help
 
114
      __usage
108
115
      exit 1
109
116
      shift
110
117
      ;;
117
124
}
118
125
 
119
126
__main () {
120
 
  if [[ ! -e "$__IN_NAME" ]]
121
 
  then
 
127
  if [[ ! -e "$__IN_NAME" ]]; then
122
128
    echo "missing input audio. Please provide."
123
129
    exit 1
124
130
  fi
125
131
  
126
 
  if [[ $__OUT_NAME == "" ]]
127
 
  then
 
132
  if [[ $__OUT_NAME == "" ]]; then
128
133
    echo "missing output file name. Please provide."
129
134
    exit 1
130
135
  fi
131
 
  
132
 
  
133
 
  if [[ $__USE_WEBM == true ]]
134
 
  then
135
 
    if [[ $__IN_NAME == $__OUT_NAME.webm ]]
136
 
    then
 
136
 
 
137
  if [[ $__USE_WEBM == true ]]; then
 
138
    if [[ $__IN_NAME == $__OUT_NAME.webm ]]; then
137
139
      echo "Filenames can't be the same."
138
140
      exit
139
141
    fi
140
142
    __enc_webm
141
 
  elif [[ $__USE_FJ == true ]]
142
 
  then
143
 
    if [[ $__IN_NAME == $__OUT_NAME.mp4 ]]
144
 
    then
145
 
      echo "Filenames can't be the same."
146
 
      exit
 
143
  elif [[ $__IN_NAME == $__OUT_NAME.mp4 ]]; then
 
144
    if [[ $__USE_FJ == true ]]; then
 
145
      __enc_fj
 
146
    else
 
147
      __enc_mp4
147
148
    fi
148
 
    __enc_fj
149
149
  else
150
 
    if [[ $__IN_NAME == $__OUT_NAME.mp4 ]]
151
 
    then
152
 
      echo "Filenames can't be the same."
153
 
      exit
154
 
    fi
155
 
    __enc_mp4
 
150
    echo " Input and output files can't be the same."
 
151
    exit
156
152
  fi
157
153
}
158
154