How to Root Xiaomi Redmi Go and Install TWRP Recovery

The Xiaomi Redmi Go is a budget entry level android phone from Xiaomi that runs the Go edition of Android 8.0 (Oreo). While specs are not its strong points, it looks and handles reasonably well for its price.

I've been using one for the past 3 months as my daily driver and overall I'm pleased with its performance and battery life. The only complain I have is on the paltry 8 GB storage though a 32GB SD card does a good job lessening its downsides.

Now the only thing that has been missing on the device up until now is root permissions. I had avoided rooting the device not so much because it voids my warranty but mostly because I had no use for it. With the right apps, the phone serves my needs well.

The way android handles external storage however is the straw that broke the camel’s back for me. From some apps not being able to write or store data in the SD to MTP just being a pain in the neck to use, I realized I had to root sooner or later.



Before Rooting

So first things first: I will not be held responsible should you end up damaging your device in the process. With that said, I'll endeavour to make this post as detailed as possible to ensure we minimize chances of that happening.

Secondly, after unlocking your bootloader you'll no longer be able to receive Android system updates and your warranty will be voided.

The particular version of Redmi Go I used is as follows:
  • Global Edition
  • Model Name: M1903C3GG
  • Android Version: 8.1.0
  • Android security patch level: 1 May 2019




Step 1: Enable Developer Options

1. On your Redmi Go to your Settings > About Phone and tap the Build Number until you get the notification that you're now a developer.

2. Next go to Settings > System > Developer Options and toggle the ON button then scroll down to the Debugging section and turn on the USB debugging toggle.


Step 2: Set Up ADB and FastBoot

The steps outlined here apply to those on Windows though the rooting can be done on both Linux or Mac.

1. Download the Android Platforms tools for Windows. This package contains ADB and Fastboot tools that we'll need for making the backups, unlocking the bootloader and flashing the recovery.

2. Extract the package on a drive on your computer e.g. in C:\adb\platform-tools. To minimize the likelihood of errors, don't extract to a folder in a long path or with spaces in it.

3. Install the Universal ADB driver for Windows (if you haven't before) then reboot your computer.

4. Connect the Redmi GO to your computer via USB then on your computer open a command window (Win Key + R > type CMD > OK) and navigate to the path of the ADB folder we extracted by typing the command:
cd C:\adb\platform-tools
Next type the following command:
adb devices
You'll get a prompt on your phone with your computer's RSA key fingerprint asking you whether to allow USB debugging. Check the Always allow from this computer then tap OK.

ADB and Fastboot is now set up and ready to use.


Step 3: Back Up Data (Optional)

Unlocking the bootloader may factory reset the phone and thus erase all the installed user apps along with any data in the internal storage. Even if it does not, its always a good idea to have a back up just in case of any unforeseen mishaps.

To avoid losing these data, you'll need to do a backup of your apps that you can restore back after we've done the rooting. Depending on your needs, you can do a backup using one or a combination of the following:

Option 1: Manual Backup

As the name suggests this implies doing the backup by yourself provided the apps allow for it. A few options you may consider include:
  • Copy all your personal data (photos, videos, music, documents etc.) in your internal storage to your computer. You can then copy them back after rooting.
  • Some apps allow you to export backups of settings or data to your storage that you can import after reinstalling the app (e.g. K-9 mail, BlackPlayer). 
  • Other apps will allow you to sync your data in the cloud to a linked account that can be restored by simply logging in to this account (e.g. Firefox).
  • Sync your contacts to your Google Account in the Contacts app or export to a VCF you can import later.
  • Backup your WhatsApp chats to Google Drive or locally. If you choose the latter make sure you back up the WhatsApp folder in the internal storage to your computer or SD Card.
  • Use the SMS Backup & Restore app to back up your SMS and Call History locally or in the cloud. After the reset, reinstall the app and restore the data backup.

Option 2: Stock Backup

This is the default backup option available in the phone settings which backups data to your Google account. To carry it out:

1. Go to Settings > System > Backup, ennable the option to Back up to Google Drive then add or choose a Google account to assign the backup.

2. Finally choose what to backup:
  • Apps and their data
  • Call History
  • Contacts
  • Device Settings (including Wi-Fi passwords and permissions)
  • SMS.

Note however that some apps and data may not be backed up. To restore this data, during the initial setup after resetting your phone just login into this account and Google will do the rest.

Option 3: ADB Backup

The ADB backup will allow you to back up app data without root. You have two options here:

a. Using the Helium app

Helium will allow you to do the backup straight from your phone though you'll still required to install the desktop app or use the Helium Chrome app in Chrome Browser to complete the backup.

In my case Helium failed to complete the backup on account of the Redmi Go being encrypted. You could try on yours though I doubt it will work. This leaves us with the second option.

b. Using ADB

This will export the ADB backup to a file in your computer.

1. Connect your phone to the PC and open a command window and navigate to the path of the ADB folder we extracted by typing the command:
cd C:\adb\platform-tools
Next run the following command to confirm that your phone is attached:
adb devices

2. ADB allows you to backup various things while excluding others. For most people however one of the following commands should suffice (where C:\Backup\ is the folder to export the backup):

To back up the data of your apps without including the apps themselves (apks) run:
adb backup -all -f C:\Backup\data.ab
To back up the data of your apps including the APKs run:
adb backup -apk -all -f C:\Backup\data.ab
To back up the data of your apps including the APKs and the data inside the internal storage run:
adb backup -apk -all -shared -f C:\Backup\data.ab

For more backup options read this reference or run adb shell bu help to see a list of commands

3. After running any of these commands your phone will immediately open a page called Full backup. In it enter a password to encrypt the backup then click tap the BACK UP MY DATA button (if your phone is not encrypted you don't have to enter a password).

Now just leave it to complete the backup. It may take anything from a few minutes if you've chosen the app only backup to over an hour if you chose to include apks and shared storage.

Below in Step 9 I've explained how to restore this backup. Now onto the good stuff.

Note:
  • Data for some apps may still be not be backed up even when using this method. Developers decide whether an adb backup is allowed for their app so unfortunately this something outside our control without root.




Step 4: Unlock the Redmi Go Bootloader

According to the tutorials online I was led to believe that to unlock the bootloader I needed to apply for an Unlock request, open a Mi Account and install the Mi Unlock tool to unlock the bootloader.. Apparently this is the standard procedure for all other Xiaomi devices.

I did exactly that but at the end of it I was greeted with a Couldn't unlock error:
mi unlock
Mi Unlock Error

Later on after some inspired searching online it turned out I could unlock it using fastboot as follows:

1. First go to Developer options in your phone and turn on the OEM unlocking toggle. If you've a pattern / security method set up, you'll be prompted to complete it.

2. Turn off your phone then get it into FASTBOOT mode by pressing the Lock + Volume Down buttons together.

3. Connect your phone to your computer and from our ADB folder run the following commands.

To confirm that your phone iscorrectly attached:
fastboot devices
To check whether the bootloader is locked or unlocked:
fastboot oem device-info
At this point it should output: <bootloader> Device unlocked: false

To unlock the bootloader.
fastboot oem unlock-go
You should get an OKAY response after running it as shown below:
fastboot commands
Bootloader Unlock Commands
The bootloader is now unlocked. To confirm, while still in FASTBOOT mode run the command fastboot oem device-info and you should get the following output: <bootloader> Device unlocked: true
bootloader unlocked
Bootloader Unlocked!

The boot screen will also now read unlocked just below the Mi logo before the Android Go logo displays. We can now proceed to flash TWRP recovery that will allow us to root the device.


Step 5: Flash TWRP Recovery

1. Get the Redmi Go TWRP Recovery from SourceForge that's provided by XDA's YasiR Siddiqui (please check this thread for updates or if the recovery link is dead).

2. Copy the recovery.img file inside the platform-tools folder

3. Get your phone in FASTBOOT mode, connect it your computer then run the following command:
fastboot flash recovery recovery.img

4. After doing this don't reboot otherwise the stock recovery will overwrite TWRP as it happened my case. Instead, run the following command to boot the TWRP recovery you've just flashed:
fastboot boot recovery.img
In TWRP go to Reboot and select Power off your device.

5. Now try getting into recovery by powering your device by pressing Lock + Volume Up button. If everything went as planned it should load TWRP Recovery.


Step 6: Fix TWRP Mount Data Partition Error

In TWRP recovery go to Backup and you may notice that the Data (excl. storage) partition reads 0 MB. If you try doing a backup in this state it will fail with the following errors while nearing the end:
could not mount /data and unable to find crypto footer
failed to mount '/data' (invalid argument)
unable to mount storage
unable to mount /data/media /TWRP/.twrps
From what I've gathered this happens because the internal storage of the Redmi Go is encrypted. To fix this:

1. Go to YasiR Siddiqui project in SourceForge and download the decrypt fix zip.

2. Put the decrypt zip file in your internal storage or inside the SD Card and boot your phone into TWRP Recovery.

3. In TWRP go to Install, select the ZIP file and tap the Install image button. After it has been flashed power off your device.

4. Boot into TWRP recovery again and check the Backup page. The Data partition size should now be listed and a backup completes successfully.


Step 7: Fix Encryption Unsuccessful Error

This happened in my case prior to knowing of the above fix. From what I had gathered at the time the only way I could get TWRP to see the Data Partition was to format the internal storage.

So I took the gamble and in TWRP went to the Wipe page and selected Format Data. Sure enough that fixed the Data partition error however on booting to System I was greeted with Encryption Unsuccessful message instructing me to reset the phone.

Hitting that reset button however only rebooted the device into TWRP before booting back again to the Encryption Unsuccessful message.

If you happen to be in the same spot, download the same decrypt zip from the previous step and put it in an SD Card. Flash it in TWRP as explained in the previous step then Reboot into System. The encryption error should now be gone.



Step 8: Root by Flashing Magisk

1. Download the latest stable Magisk Installer along with Magisk Manager APK from the official page on GitHub.

2. Copy the Magisk installer zip in your storage and boot into TWRP recovery.

3. Go to Install, select the Magisk ZIP file from your storage then tap the Install image button.

4. Reboot your phone and install the Magisk Manager apk. Finally launch the app and allow it to check for updates. You're now rooted!

From its menu you can access Superuser to manage apps given root permissions and install and manage modules to tweak your phone.


Step 9: Restore ADB Backup

If you did an ADB backup as outlined ins Step 3 (c), you can restore it by simply connecting the phone to computer and running the following adb command (where C:\backup\data is the path to the data backup) :
adb restore C:\backup\data.ab
Run this command ONLY after having installed all the apps that were installed during the backup and wish to restore their data.

To batch install apps using ADB, put their apks in one folder and ensure none of them has spaces in their name, then run the following command (where C:\apk\ is the folder with the APKs):
for %f in (C:\apk\*.apk) do adb install "%f"
After doing this, run the restore the command and your apps' data (including contacts, call history and SMS) will be restored.

This likewise applies to those that included apks in their backup as in my case the restore did not reinstall the apps from the backup as I had expected. The shared data will however be restored into the internal storage as it was before.


Step 10: Create a Nandroid Backup

Now that your phone is rooted and has all the apps you want in it, go to TWRP > Backup and do a full backup of your phones partitions (System, Data, Boot). You can then rest assured that you've a backup that you can always restore should anything happen to your Redmi Go.

This backup however doesn't include any of your personal data (such as photos, videos, music) inside the internal storage. For these you'll have to backup manually by either copying them to an external storage (e.g. your PC) or uploading/syncing them to a cloud storage (e.g. Google Drive).

And so this marks the end of this rather long tutorial. Good luck to you!

How to Unlfip Mirrored Videos using VirtualDub

Not long ago I covered on how to unflip videos using various Windows video players. That was however only a temporary measure as the players merely flip horizontally the decoded video. A permanent solution requires the video to be encoded (converted) with an appropriate video setting applied to unflip the image.

Most run of the mill free video converters out there however don't usually support such a setting save for clipping, cropping and some simple video effects to adjust brightness and contrast.

As a result, you may be forced to use a commercial alternative or full blown video editor suites such as Sony Vegas for this simple task. This is however unnecessary as you can use the free open source VirtualDub (VDub) with its filters to do this in a couple of minutes. Let me show you how.


Step 1: Install VirtualDub

1. Download the latest version of VirtualDub from the homepage. If you're on Linux, you may be able to run VDub in your distribution using Wine.

2. To install it just extract the package to a folder somewhere in your computer.



Step 2: Install VirtualDub FFMpeg Input Plugin

VDub doesn't support some modern video file formats such as MP4, MOV and WebM. The only common format it supports out of the box is AVI however you may also run into problems with this format if it's using some unsupported codecs such H.264/AVC, VP8/VP9 etc.

To get past this limitation we need to install a plugin such as the FFMpeg Input Plugin which allow you to open most if not all common video formats out there. To do that:

1. Download the latest FFMpeg Input plugin from the SourceForge.

2. Run the setup file to install the plugin. When prompted to choose the folder where to install, select the folder where you extracted VirtualDub.


Step 3: Unflip Video with Flip Horizontally Filter

1. Run the program by running VirtualDub.exe.

2. Press Ctrl+O or go to File > Open video file... and select the flipped video. You can also open the video by dragging and dropping it inside VirtualDub.

3. In the toolbar go to Video > Filters or press Ctrl+F.

4. Click the Add... button, select the flip horizontally filter and then click OK to add it.

5. On the video preview you'll now notice that the video has been flipped.
flip horizontally preview
Right: Original Video, Left: Unmirrored Preview

The easiest way to know this is to seek to a section in the video where there is some visible text like captions, credits or a watermark. The text should now be readable.

6. Next if you don't mind saving the file to AVI just go to File and select Save as AVI... or press F7. You can then convert the AVI to whichever other format you want using a video converter.



Step 4: Save Video to MP4 or Other Formats

While VirtualDub only supports saving to AVI it does provide a means for using external encoders since version 1.10+. The appropriate external decoders if set up correctly can be used to export the edited video to MP4, MKV, MOV and other formats.

A good guide on how to set up some external encoders to save to various formats can be read here. For the purpose of this tutorial however I'll cover only exporting to MP4 or MOV using FFMpeg as explained in that guide.

To do that:

1. First download and install FFMpeg for the version of Windows you're running.

2. Next download this VDub profile file or copy the code provided here and save it to a file named ffmpeg-1.vdprof.

3. In VirtualDub go to Options > External encoders... then click the Import... button and select the ffmpeg-1.vdprof file. Doing that will import three different profiles:
  • mov ff x264+pcm: to encode to MOV with x264 video and PCM audio (i.e. WAV - if you need lossless audio)
  • mp4 ff mpeg4 q1+ac3: to encode to MP4 with MPEG-4 video and AC3 audio
  • mov ff mjpeg+pcm: to encode to MOV with MJPEG video (lossless) and PCM audio (lossless)
import vdprof profile

4. Switch to the Encoders tab with the following list of profiles.
encoder profile

Double click to open each of the profiles and in the Program box select the path to where FFMpeg is installed e.g. in C:\Program Files\ffmpeg\bin\ffmpeg.exe
encoder path

Click OK and that's it.

5. Now to save your video, go to File > Export > Using external encoder... and select one of the profiles you've just set up and click OK.

6. Choose where to save the encoded file and give it a name then click the Save button to start the encoding. Give VirtualDub some time to do the encoding. Your video will be flipped horizontally and saved in MP4 or MOV.

TIP:
  • You can encode to the lossless MOV format then use a normal video converter to save it to any other format using your preferred codecs and encoding settings for video and audio.

How to Clear Only the Search History in Firefox

Firefox keeps a history search engine searches (google, bing etc) done in the search bar or the address bar. This way it's able to automatically suggest previous searches for you when you start typing words that match to those searches.

While the search bar and address bar suggestions can be disabled, you can also opt to just clear the search history.

Additionally, in Firefox you can delete the search history on its own unlike in Chrome and some other browsers where this option is usually unavailable.

To do this:

1. Press Ctrl+Shift+Del or reveal the toolbar and go to History > Clear Recent History...

2. At the top of the Clear All History window select the time range to clear. If you want to clear the entire search history leave it at Everything.

3. Below History uncheck all items except the Form & Search History.
clear all history
Clear Form & Search History

4. Click the Clear Now button to start the deletion. That's it.

Load External Audio Track for a Video in VLC

In VLC for Windows it's possible to add a separate audio track to a video that either has no audio stream or that has one but you want to play a different audio.

With that said the process is a bit long-winded compared to doing it on PotPlayer and MPC-HC. The steps are as follows:

1. Open VLC and on the toolbar go to Media -> Open Multiple Files... or press Ctrl+Shift+O.

2. Browse and select your video file by clicking the Add button. You can also load a video by dragging it inside the window.
add  video
Add Video

3. At the bottom of the window check the Show more option setting.

4. Next check the Play another media synchronously option then click the Browse button beside the Extra media box.

5. Browse and add the external audio (e.g. aac/m4a, ac3, mp3, ogg/opus etc) file by clicking the Add button. You can also select another video to use its audio stream as the external audio.

Click the Select button when you're done.
select external audio
Select external audio

5. Click the Play button to start playback or Enqueue if you need to add other files to play.


Having a Problem Loading External AAC Audio?

I've noticed VLC ignores the external audio track if it's in AAC (filename.aac). To solve this issue, change the extension of the audio file to M4A (filename.m4a) and try again.

M4A and AAC are technically the same audio file format so this shouldn't affect playback of the file with other media players.

Load External Audio Track for a Video in MPC-HC

Sometimes you may want to either add an audio track to a video that has none or to play a different audio track to the one it has e.g. a commentary.

You can do this quite easily using Media Player Classic (MPC-HC) by doing either of the following:


Option 1: Load External Audio Automatically

For a video that has no audio track, MPC-HC will automatically play a separate audio track if it has the same name as the video and are both located in the same folder. e.g. Bick Buck Bunny.mkv (video) and Bick Buck Bunny.m4a (audio)

This function is usually turned on by default when you install MPC-HC. The option can be enabled or disabled by going to: Options > Playback > Auto-load audio files


Option 2: Load External Audio Manually

With this option you can load a separate audio track with a different name. Additionally, this allows you to add a different audio stream to a video that already has an audio track(s) so that you can easily switch between them.

To do this:

1. Open MPC-HC and press Ctrl+O or right-click inside it's window and then go to File > Open File...

2. In the Open box browse and select the video file and then in the Dub box browse and select a playable external audio file (e.g. aac/m4a, ac3, mp3, ogg/opus etc). Click Ok when done.
open and dub sources
Load video and external audio

3. If the selected video has no audio file, MPC-HC will automatically play the audio track selected.
select audio stream
Switch between external and internal audio

If the video had its own audio stream, you'll have to switch to the external audio track by selecting it by right-clicking > Audio Track > External Audio File

Load External Audio Track for a Video in PotPlayer

You can use PotPlayer to play an external audio file for a video that has no embedded audio stream.
The external audio can also be loaded in a video with an audio stream, you only have to override it by selecting the external audio. e.g. a commentary audio

To do this:

1. Open your video with PotPlayer.

2. Right-click inside its window and select Open > Load external audio.
load external audio
Select external audio

3. Browse and open the external audio file in a playable format (e.g. aac/m4a, ac3, mp3, ogg/opus etc). You can also select a video to use its audio stream as the external audio.

To do that, in the Browse window beside the filename box click the dropdown box and select All files. You can then select a video file.

4. If the opened video had no audio track, PotPlayer will now automatically play the selected external audio file.
switch audio stream
Switch between audio internal and external treams

If the video had audio, you'll have to switch to the external audio track by right-clicking > Audio > Select Audio Stream > External Audio File ID