Hi! I wrote a small application a little while ago. It's kind of similar to Kindle's global search option (Search My Items) but only for movies with subtitles. All you need is a folder with video files in it and .srt subtitles nearby with the same name. It supports sub-folders. It's been inspired by Videogrep: Automatic Supercuts with Python and PlayPhrase.me (it probably had been shut down permanently).
Here's the link - https://github.com/kelciour/playphrase
Here's demonstration of how program works:
PlayPhrase: search and play phrases from movies and audiobooks
-
- White Belt
- Posts: 17
- Joined: Wed Feb 01, 2017 11:39 pm
- Languages: Russian (N), English (self-study)
- x 34
- emk
- Black Belt - 1st Dan
- Posts: 1708
- Joined: Sat Jul 18, 2015 12:07 pm
- Location: Vermont, USA
- Languages: English (N), French (B2+)
Badly neglected "just for fun" languages: Middle Egyptian, Spanish. - Language Log: viewtopic.php?f=15&t=723
- x 6721
- Contact:
Re: PlayPhrase: search and play phrases from movies and audiobooks
Thank you! This looks like a really useful tool for people who have video with *.srt files! I especially like the fact that it runs over entire directory hierarchies? Does it support either wildcards or regular expressions?
(I've been very slowly working on a library to automatically parse VobSub subtitles, and somebody I hope to add automatic OCR to generate *.srt files without human intervention. But it's going to take a while!)
(I've been very slowly working on a library to automatically parse VobSub subtitles, and somebody I hope to add automatic OCR to generate *.srt files without human intervention. But it's going to take a while!)
0 x
-
- White Belt
- Posts: 17
- Joined: Wed Feb 01, 2017 11:39 pm
- Languages: Russian (N), English (self-study)
- x 34
Re: PlayPhrase: search and play phrases from movies and audiobooks
Yes, it scans 'media_dir' recursively. Actually, it's a very simple script. It uses the program 'grep' under the hood to do all the search (line #155) and it supports wildcards and regular expressions. I only join subtitles into 'sentences' and generate .txt files with format like that ("Pete's Dragon (1977).txt"):emk wrote:I especially like the fact that it runs over entire directory hierarchies? Does it support either wildcards or regular expressions?
Code: Select all
(00:35:05,740, 00:35:07,742) Who's Elliott?
(00:35:07,825, 00:35:10,828) - My dragon. - Dragon?
(00:35:10,912, 00:35:14,165) So you're the boy with the dragon.
After that 'grep' do the search and I only open up mpv video player and add search results as a playlist. That's all .
4 x
-
- Posts: 4
- Joined: Thu Aug 24, 2017 7:41 pm
- Languages: Spanish(N) English (Beginner)
- x 3
Re: PlayPhrase: search and play phrases from movies and audiobooks
Do you have support for windows 7 x64
0 x
-
- White Belt
- Posts: 17
- Joined: Wed Feb 01, 2017 11:39 pm
- Languages: Russian (N), English (self-study)
- x 34
Re: PlayPhrase: search and play phrases from movies and audiobooks
Yes. Download 'playphrase-win32.zip' file from the Releases page. After that edit 'videogrep.bat' file by updating 'media_dir' path and double-click on it.siwars wrote:Do you have support for windows 7 x64
0 x
-
- White Belt
- Posts: 18
- Joined: Wed Sep 06, 2017 11:58 pm
- Languages: Spanish(N) English(beginner)
- x 9
Re: PlayPhrase: search and play phrases from movies and audiobooks
kelciour wrote:Yes. Download 'playphrase-win32.zip' file from the Releases page. After that edit 'videogrep.bat' file by updating 'media_dir' path and double-click on it.siwars wrote:Do you have support for windows 7 x64
videogrep.bat
Hello, I have edited it that way on windows
Code: Select all
@echo off
setlocal EnableDelayedExpansion
set media_dir="C:\Users\user\Videos\videos"
for /L %%n in (1,0,1) do (
set /p phrase="Phrase: "
if /I "!phrase!"=="q" call :stop
if /I "!phrase!"=="x" call :stop
if /I "!phrase!"=="quit" call :stop
if /I "!phrase!"=="exit" call :stop
playphrase.exe --input %media_dir% "!phrase!"
)
:stop
call :__stop 2>nul
:__stop
() creates a syntax error, quits the batch
the result is
Code: Select all
Phrase: la gallina se ha escapado
WARNING: number of '.srt' and '.txt' files doesn't match. Maybe you need to use
'videogrep <media_dir> _init_'.
'la gallina se ha escapado' is not found in 'C:\Users\user\Videos\videos'
.srt
Code: Select all
2
00:01:52,554 --> 00:01:56,357
¡Eh, la gallina se ha escapado!
¡Atrápala, hombre!
3
00:01:59,997 --> 00:02:02,300
¡Vamos, vamos!
What video format do you recommend using and in what form do you use subtitles?
Last edited by spanglish on Fri Sep 08, 2017 12:10 am, edited 1 time in total.
0 x
-
- White Belt
- Posts: 17
- Joined: Wed Feb 01, 2017 11:39 pm
- Languages: Russian (N), English (self-study)
- x 34
Re: PlayPhrase: search and play phrases from movies and audiobooks
spanglish
If you see the warning "number of '.srt' and '.txt' files doesn't match" enter _init_ at first and only after that "la gallina se ha escapado". It will look like this:
If you don't see this warning you don't need to enter _init_:
PlayPhrase supports only 'mp4', 'avi', 'mkv' video files but I can update source code if it won't be enough.
If you see the warning "number of '.srt' and '.txt' files doesn't match" enter _init_ at first and only after that "la gallina se ha escapado". It will look like this:
Code: Select all
Phrase: _init_
J:\English Movies\Catch Me If You Can (2002).srt
J:\English Movies\Robin Hood (1973).srt
J:\English Movies\Pete's Dragon (1977).srt
...
Phrase: la gallina se ha escapado
If you don't see this warning you don't need to enter _init_:
Code: Select all
Phrase: la gallina se ha escapado
PlayPhrase supports only 'srt' subtitles.spanglish wrote:What video format do you recommend using and in what form do you use subtitles?
PlayPhrase supports only 'mp4', 'avi', 'mkv' video files but I can update source code if it won't be enough.
1 x
-
- White Belt
- Posts: 18
- Joined: Wed Sep 06, 2017 11:58 pm
- Languages: Spanish(N) English(beginner)
- x 9
Re: PlayPhrase: search and play phrases from movies and audiobooks
Is it possible in the future that I have support for android?
and can be compatible with frequent word lists in ankidriod
and can be compatible with frequent word lists in ankidriod
0 x
-
- White Belt
- Posts: 17
- Joined: Wed Feb 01, 2017 11:39 pm
- Languages: Russian (N), English (self-study)
- x 34
-
- White Belt
- Posts: 17
- Joined: Wed Feb 01, 2017 11:39 pm
- Languages: Russian (N), English (self-study)
- x 34
Re: PlayPhrase: search and play phrases from movies and audiobooks
I've updated the script and recorded demo to show how to set it up and run on Windows.
Changes:
- Now it supports multiline search, for example, "I've been staring at.*?I can lead with pride.*?How far I'll go".
- Added option to extract search results as video or audio fragments:
Changes:
- Now it supports multiline search, for example, "I've been staring at.*?I can lead with pride.*?How far I'll go".
- Added option to extract search results as video or audio fragments:
- By using command-line options:
Code: Select all
-a, --audio - export as audio
-v, --video - export as video
-s, --video-sub - export as video with subtitles - Or by using cut.lua script for mpv videoplayer to set the start time and the end time while watching the video and export it as audio, video or video with subtitles.
By default the hotkeys are:Code: Select all
w - set the start time
e - set the end time
z - export as audio
x - export as video
c - export as video with subtitles
Standard mpv hotkeys:Code: Select all
LEFT and RIGHT - Seek backward/forward 5 seconds. Shift+arrow does a 1 second exact seek.
UP and DOWN - Seek forward/backward 1 minute. Shift+arrow does a 5 second exact seek.
Ctrl+LEFT and Ctrl+RIGHT - Seek to the previous/next subtitle. Subject to some restrictions and might not always work; see ...
. - Step forward. Pressing once will pause, every consecutive press will play one frame and then go into pause mode again.
. - Step backward. Pressing once will pause, every consecutive press will play one frame in reverse and then go into pause mode again.
More: https://mpv.io/manual/master/#keyboard-control
- The cut.lua script had been included in playphrase-win32.zip archive (utils/mpv/scripts) or it can be downloaded via this link.
- To get it working you either can add the path to the folder that contains ffmpeg.exe (that can be found inside playphrase-win32.zip or downloaded from https://ffmpeg.zeranoe.com) in your PATH environment variable or edit cut.lua and update the line #3 by using the absolute path to ffmpeg.exe instead of [[ffmpeg]], for example, [[C:\Programs\playphrase\utils\ffmpeg\ffmpeg.exe]].
- By default encoding preset is 'ultrafast'. By editing cut.lua file it can be changed, for example, to 'medium'. With these changes it'll took more time to export video fragments, but the result file size will be much smaller (~2 times less).
1 x
Return to “Language Programs and Resources”
Who is online
Users browsing this forum: evandro and 2 guests