Compare commits

...

18 Commits

Author SHA1 Message Date
Maksim Ivanov
69c2b39fc4 Update README.md 2021-09-23 21:29:47 +03:00
Maksim Ivanov
03743dbe3d Update README.md 2021-09-23 21:29:07 +03:00
Maksim Ivanov
f3e2780911 Update README.md 2021-09-22 09:04:00 +03:00
Maksim Ivanov
c829b43a97 Instruction how to disable Widevine fix 2021-09-21 14:59:33 +03:00
Maksim Ivanov
157b47fb81 README.md rework 2021-09-20 17:58:27 +03:00
Maksim Ivanov
749d04e983 Some checks added 2021-09-19 22:27:40 +03:00
Maksim Ivanov
de681b22c8 Less console output. Minor fixes 2021-09-19 22:27:30 +03:00
Maksim Ivanov
e4e5108b8c Placing ffmpeg to lib_extra 2021-09-19 22:27:22 +03:00
Maksim Ivanov
009d48f6f2 Removed dpkg dependency for Widevine extracting 2021-09-19 22:27:13 +03:00
Maksim Ivanov
db1616eaeb Removed curl dependency 2021-09-19 22:26:39 +03:00
a275e5b442 Auto-fix hook option added 2021-09-17 19:03:01 +03:00
Maksim Ivanov
e303fe6f1d Branch-specific changes to README 2021-09-16 21:43:46 +03:00
c7b5adf475 Merge branch 'main' into lazy 2021-09-16 21:39:22 +03:00
1f469e262c Added alternative download source for ffmpeg 2021-09-16 21:34:06 +03:00
ececb7206e Auto-select ffmpeg source 2021-09-16 21:31:15 +03:00
Maksim Ivanov
755b753e9b Update readme for alt-ffmpeg branch 2021-09-16 21:06:24 +03:00
Maksim Ivanov
d5f1a745e4 README update 2021-09-16 19:36:26 +03:00
5654313dc9 First try to implement auto-fix after upgrade 2021-09-16 18:58:38 +03:00
3 changed files with 82 additions and 57 deletions

2
99fix-opera Normal file
View File

@@ -0,0 +1,2 @@
DPkg::Pre-Invoke {"stat -c %Z /usr/lib/x86_64-linux-gnu/opera/opera > /tmp/opera.timestamp";};
DPkg::Post-Invoke {"if [ `stat -c %Z /usr/lib/x86_64-linux-gnu/opera/opera` -ne `cat /tmp/opera.timestamp` ]; then ~root/.scripts/fix-opera.sh; fi; rm /tmp/opera.timestamp";};

View File

@@ -1,67 +1,56 @@
# Fix Opera Linux ffmpeg # Fix Opera Linux ffmpeg & WidevineCdm
* Fix Opera html5 media content. * Fix Opera html5 media content
* It script must be execute all times opera will fails on showing html5 media content. * It script must be execute all times opera will fails on showing html5 media content.
* Now it also fixes WidevineCdm support for DRM video. You can try it on Vevo youtube channel for example. * Now it also fixes WidevineCdm support for DRM video. You can try it on Vevo youtube channel for example.
## Index ## Requirements
* [Requirements](#Requirements)
* [How use](#How-use)
* [Create an alias](#Create-an-alias)
### Requirements
1. **wget** (Is needed for downloading the ffmpeg lib and Chrome) 1. **wget** (Is needed for downloading the ffmpeg lib and Chrome)
```sudo apt install wget``` ```sudo apt install wget```
2. **unzip** (Is needed for unzipping the downloaded file) 2. **unzip**, **binutils** (Is needed for unpacking the downloaded file)
```sudo apt install unzip``` ```sudo apt install unzip binutils```
### How use ## Usage
1. Clone this repo 1. Clone this repo
```git clone https://github.com/Ld-Hagen/fix-opera-linux-ffmpeg-widevine.git``` ```git clone https://github.com/Ld-Hagen/fix-opera-linux-ffmpeg-widevine.git```
2. Go to the repo root folder 2. Go to the repo root folder
```cd ./fix-opera-linux-ffmpeg-widevine``` ```cd ./fix-opera-linux-ffmpeg-widevine```
3. Give execute permissions to the script file 3. (*Optional*) You may disable **Widevine** fix if one that comes with Opera works well for you.
```chmod +x ./fix-opera.sh``` ```sed -i '/FIX_WIDEVINE=/s/true/false/g' ./fix-opera.sh```
4. Execute the script using sudo (Is needed for put the ffmpeg lib into the opera instalation folder) 4. Run script. And if it works well got ot next step.
```sudo ./fix-opera.sh``` ```sudo ./fix-opera.sh```
### Create an alias 5. Create a **.scripts** folder on **root**'s **home**
1. Clone this repo
```git clone https://github.com/Ld-Hagen/fix-opera-linux-ffmpeg-widevine.git``` ```sudo mkdir ~root/.scripts```
2. Create a **script** folder on your **home** 6. Copy the script into the **.scripts** folder
```mkdir ~/.scripts``` ```sudo cp ./fix-opera.sh ~root/.scripts```
3. Copy the script into the **script** folder 7. Choose one or both options
* (*Optional*) Create an **alias**. And then you'll be able to start it by typing ```fix-opera``` command in terminal.
```cp ./fix-opera-linux-ffmpeg-widevine/fix-opera.sh ~/.scripts``` ```echo "alias fix-opera='sudo ~root/.scripts/fix-opera.sh' # Opera fix HTML5 media" >> ~/.bashrc```
4. Give execute permissions to the script file ```source ~/.bashrc```
```chmod +x ~/.scripts/fix-opera.sh```
5. Create an **alias** on the **.bashrc** file (Remember replace **<YOUR_USER>** for your linux user) * (*Optional*) Autostart after each opera upgrade (Debian-based distros)
```echo "alias fix-opera='sudo /home/<YOUR_USER>/.scripts/fix-opera.sh' # Opera fix HTML5 media" >> ~/.bashrc``` ```sudo cp ./99fix-opera ~root/.scripts```
```sudo ln -s ~root/.scripts/99fix-opera /etc/apt/apt.conf.d/```
6. Update **.bashrc** file 8. Delete the repo
```source ~/.bashrc``` ```cd .. && rm -rf ./fix-opera-linux-ffmpeg-widevine```
7. Delete the repo
```rm -rf ./fix-opera-linux-ffmpeg-widevine```

View File

@@ -7,53 +7,87 @@ if [[ $(whoami) != "root" ]]; then
fi fi
readonly TEMP_FOLDER='/tmp/' readonly TEMP_FOLDER='/tmp/'
readonly OPERA_FOLDER='/usr/lib/x86_64-linux-gnu/opera/' readonly OPERA_FOLDER='/usr/lib/x86_64-linux-gnu/opera'
readonly FILE_NAME='libffmpeg.so' readonly FILE_NAME='libffmpeg.so'
readonly ZIP_FILE='.zip' readonly ZIP_FILE='.zip'
readonly TEMP_FILE="$TEMP_FOLDER$FILE_NAME" readonly TEMP_FILE="$TEMP_FOLDER$FILE_NAME"
readonly OPERA_FILE="$OPERA_FOLDER$FILE_NAME" readonly OPERA_FILE="$OPERA_FOLDER/lib_extra/$FILE_NAME"
readonly FIX_WIDEVINE=true readonly FIX_WIDEVINE=true
readonly CHROME_DL_LINK="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" readonly CHROME_DL_LINK="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
readonly GIT_API=https://api.github.com/repos/Ld-Hagen/fix-opera-linux-ffmpeg-widevine/releases readonly GIT_API_MAIN=https://api.github.com/repos/iteufel/nwjs-ffmpeg-prebuilt/releases
readonly GIT_API_ALT=https://api.github.com/repos/Ld-Hagen/fix-opera-linux-ffmpeg-widevine/releases
printf '\nGetting Url ...\n' if ! which ar > /dev/null && $FIX_WIDEVINE; then
printf '\033[1mbinutils\033[0m package must be installed to fix Widevine\n'
exit 1
fi
readonly OPERA_FFMPEG_URL=$(curl -s $GIT_API | grep browser_download_url | cut -d '"' -f 4 | grep linux-x64 | head -n 1) if ! which unzip > /dev/null; then
printf '\033[1munzip\033[0m package must be installed to run this script\n'
exit 1
fi
printf '\nDownloading ffmpeg ...\n' if ! which wget > /dev/null; then
printf '\033[1mwget\033[0m package must be installed to run this script\n'
exit 1
fi
wget $OPERA_FFMPEG_URL -O "$TEMP_FILE$ZIP_FILE" printf 'Getting ffmpeg download Url ...\n'
readonly OPERA_FFMPEG_URL_MAIN=$(wget -qO - $GIT_API_MAIN | grep browser_download_url | cut -d '"' -f 4 | grep linux-x64 | head -n 1)
readonly OPERA_FFMPEG_URL_ALT=$(wget -qO - $GIT_API_ALT | grep browser_download_url | cut -d '"' -f 4 | grep linux-x64 | head -n 1)
printf "\nUnzipping ...\n\n" if [ `basename $OPERA_FFMPEG_URL_ALT` \< `basename $OPERA_FFMPEG_URL_MAIN` ]; then
readonly OPERA_FFMPEG_URL=$OPERA_FFMPEG_URL_MAIN
else
readonly OPERA_FFMPEG_URL=$OPERA_FFMPEG_URL_ALT
fi
unzip "$TEMP_FILE$ZIP_FILE" -d $TEMP_FILE if [ -z "$OPERA_FFMPEG_URL" ]; then
printf 'Failed to get ffmpeg download URL. EXiting...\n'
exit 1
fi
printf "\nMoving file on $OPERA_FILE ...\n" printf 'Downloading ffmpeg ...\n'
wget -q --show-progress $OPERA_FFMPEG_URL -O "$TEMP_FILE$ZIP_FILE"
if [ $? -ne 0 ]; then
printf 'Failed to download ffmpeg. Check your internet connection or try later\n'
exit 1
fi
printf "Unzipping ...\n"
unzip "$TEMP_FILE$ZIP_FILE" -d $TEMP_FILE > /dev/null
printf "Moving file on $OPERA_FILE ...\n"
mkdir -p "$OPERA_FOLDER/lib_extra"
mv -f "$TEMP_FILE/$FILE_NAME" $OPERA_FILE mv -f "$TEMP_FILE/$FILE_NAME" $OPERA_FILE
printf '\nDeleting Temporary files ...\n' printf 'Deleting Temporary files ...\n'
find $TEMP_FOLDER -name "*$FILE_NAME*" -delete find $TEMP_FOLDER -name "*$FILE_NAME*" -delete
if $FIX_WIDEVINE if $FIX_WIDEVINE
then then
rm -rf "$OPERA_FOLDER/lib_extra" rm -rf "$OPERA_FOLDER/lib_extra/WidevineCdm"
mkdir "$OPERA_FOLDER/lib_extra" printf "Downloading Google Chrome ...\n"
printf "\nDownloading Google Chrome ...\n" mkdir "$TEMP_FOLDER/chrome"
wget -P "$TEMP_FOLDER" "$CHROME_DL_LINK" cd "$TEMP_FOLDER/chrome"
wget -q --show-progress "$CHROME_DL_LINK"
if [ $? -ne 0 ]; then
printf 'Failed to download Google Chrome. Check your internet connection or try later\n'
exit 1
fi
printf "\nExtracting Chrome to temporary folder ...\n" printf "Extracting Chrome to temporary folder ...\n"
CHROME_PKG_NAME=`basename $CHROME_DL_LINK` CHROME_PKG_NAME=`basename $CHROME_DL_LINK`
dpkg -x "$TEMP_FOLDER/$CHROME_PKG_NAME" "$TEMP_FOLDER/chrome" ar x "$CHROME_PKG_NAME"
tar xf data.tar.xz
printf "\nInstalling WidevineCdm ...\n" printf "Installing WidevineCdm ...\n"
cp -R "$TEMP_FOLDER/chrome/opt/google/chrome/WidevineCdm" "$OPERA_FOLDER/lib_extra/" cp -R "$TEMP_FOLDER/chrome/opt/google/chrome/WidevineCdm" "$OPERA_FOLDER/lib_extra/"
printf "[\n {\n \"preload\": \"$OPERA_FOLDER/lib_extra/WidevineCdm\"\n }\n]\n" > "$OPERA_FOLDER/resources/widevine_config.json" printf "[\n {\n \"preload\": \"$OPERA_FOLDER/lib_extra/WidevineCdm\"\n }\n]\n" > "$OPERA_FOLDER/resources/widevine_config.json"
printf "\nDeleting temprorary files ...\n" printf "Deleting temprorary files ...\n"
rm -rf "$TEMP_FOLDER/chrome" rm -rf "$TEMP_FOLDER/chrome"
else else
printf "\nInstalling WidevineCdm skipped\n" printf "Installing WidevineCdm skipped\n"
fi fi