Showing posts with label extract. Show all posts
Showing posts with label extract. Show all posts

01 September 2025

How to extract texts from an image on ubuntu?

To extract English texts - 
$ sudo apt install tesseract-ocr
$ tesseract your_image_name.png extracted_text.txt 

 

To extract Simplified Chinese texts -

$ sudo apt install tesseract-ocr tesseract-ocr-chi-sim

$ tesseract your_image.tiff output_text.txt -l chi_sim

 

To extract Traditional Chinese texts -

$ sudo apt install tesseract-ocr tesseract-ocr-chi-tra

$ tesseract your_image.tiff output_text.txt -l chi_tra

 

To extract multiple languages, e.g. English and Simplified Chinese, and Traditional Chinese texts -

$ tesseract your_image.tiff output_text.txt -l eng+chi_sim+chi_tra

16 September 2023

Copy text from pictures on Linux with Textsnatcher

https://www.addictivetips.com/ubuntu-linux-tips/copy-text-from-pictures-on-linux-with-textsnatcher/

$ sudo apt install flatpak

$ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

$sudo flatpak install flathub com.github.rajsolai.textsnatcher


Step 1: With Textsnatcher open, find the “Snatch Now!” button and click on it with the mouse. After selecting this button, Textsnatcher should open up the default screenshot tool for your Linux desktop.

Note: if you use Gnome or a Gnome-based desktop environment, it will launch the Gnome screenshot tool.

Step 2: With the screenshot tool open, find the “Select an area to grab” option and click on it with the mouse. When you select this button, the screenshot tool will allow you to take a screenshot of a selected area on the desktop.

Step 3: After you’ve selected the “select an area to grab” option, your mouse cursor will become a cross icon. Click and drag over the area you wish to extract text from.

Step 4: Once you’ve selected an area on the desktop with the cursor, the screenshot tool will take a picture. It will open up a dialog box that says, “Share this screenshot with TextSnatcher?”

Select the “Share” button to share the screenshot to Textsnatcher so that it can extract the text contents of the image.

Step 5: With the screenshot exported to Textsnatcher, you should see a message that says “Checkout Clipboard.” From here, go to a text editor (or any other text field) and press Ctrl + V hotkey to paste the text.

24 March 2021

How to extract a section from a video with ffmpeg?

How to extract a section from a video with ffmpeg?

https://superuser.com/questions/377343/cut-part-from-video-file-from-start-position-to-end-position-with-ffmpeg

How to cut a video, without re-encoding

Use this to cut video from [start] for [duration]:

ffmpeg -ss [start] -i in.mp4 -t [duration] -c copy out.mp4

Here, the options mean the following:

  • -ss specifies the start time, e.g. 00:01:23.000 or 83 (in seconds)
  • -t specifies the duration of the clip (same format).
  • Instead of -t you can also supply the end time with -to.
  • -c copy copies the first video, audio, and subtitle bitstream from the input to the output file without re-encoding them. This won't harm the quality and make the command run within seconds.

Note that if you've used -ss, you have to subtract this from the -to timestamp. For example, if you cut with -ss 3 -i in.mp4 -to 5, the output will be five seconds long.

For more info, see https://trac.ffmpeg.org/wiki/Seeking

11 February 2019

Download, Extract, Convert videos

Download video with youtube-dl.exe

youtube-dl https://www.youtube.com/watch?v=S277aJyUehw


Converting video formats with ffmpeg.exe

ffmpeg -i input -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k \
-movflags +faststart -vf scale=-2:720,format=yuv420p output.mp4
ffmpeg -i test.mp4 -codec:v libtheora -qscale:v 6 -codec:a libvorbis -qscale:a 6 test.ogv


Extract part of a video with ffmpeg

ffmpeg -ss 00:00:30 -i orginalfile -t 00:00:05 -vcodec copy -acodec copy newfile