Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 01-13-2014, 03:56 AM   #1
ppoo
Connoisseur
ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.
 
Posts: 55
Karma: 40393
Join Date: May 2012
Device: Kindle Touch
Smile Convert video lecture + subtitle to images

As title, convert video lecture to which has subtitle belongs to images. These images include 1 image with subtitle at start time of subtitle, and 1 image without image at end time of subtitle.
I think it is not only useful to have video lecture note(note imbeded in image) rather than just note, but also it can be read on Kindle as series' images.

Python command to convert video to image ( especially video lectures)
Usage:
Code:
python vidlec2img.py --video-file-path ~/home/test.mp4
By default subtitle should be in same folder as video file with extension .srt.
For more detail running with --help flag
Requirement:
  • Python 2.7.6
  • Numpy MKL-1.8.0
  • OpenCV 2.4.7 or 2.4.8
  • Pysrt
  • Pillow-2.3.0
  • Requests
Can download all these libraries from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/

Attachments contains images with input is video lecture: 1 - 2 - Tools Setup for Linux (12_24) - Functional Programming course on Coursera.org

And git repo: https://github.com/anhhh11/vidlec2img

Note: It also works quite well with video from Internet (at least http as I've tried) but first you must have its subtitle file .srt and then set --output-path pararameter. It can also be use to preview some videos like youtube thumbnails but bigger and has subtitle and at most faster because it only seek particular images Thanks for opencv.

UPDATE:
  • Unicode support, and more options for changing (subtitle size/color/margin/border)
  • Add resume feature.
  • Change others file path to depend on subtitle file.
  • Allow streaming from http link with redirect; With video required login using --cookie-json-path to add cookie ( only accept cookie export by Google Chrome extension named "Edit This Cookie".
  • Fix unicode subtitle reading error.
  • Add scale image function
  • Add archiving function
  • Add converting from list function
  • Running and result:
  • Fix error pick same images for many subtitle
  • - I've just tested 30min, first time run on my KT and check the video. Sorry for ones've downloaded before ;( . It works well now
Code:
$ python vidlec2img.py -vp "C:/video/Programming/FunctionalProgramming/1 - 2 -
Tools Setup for Linux (12_24).mp4" --font-path C:/arial.ttf -iot JPG -ST -ff  F
ONT_HERSHEY_COMPLEX_SMALL
[##############################] - 100.0% - 143/143 Total
Done!
Elapsed time: 0:00:18.534677
converting from list:
Code:
#list structure
[ ["http://subtitle1.srt", "http://sub", "foldername1" ],
 ["http://subtitle1.srt", "http://sub", "foldername1" ]
]
command convert from folder: (I've use -t flag for testing first 10 image so when using resume mode (-R) it skips these images.

Code:
$>python ~/Desktop/video_lecture_to_img/vidlec2img.py -fsp "/mnt/sda5/video/DataA/IntroMSBigData/" -G -bsz 2 -fp "/usr/share/fonts/truetype/droid/DroidSerif-Regular.ttf" -ST -RSZ -U -R -MM
MSBigDataM01_mid
[##############################] - 98.56% - 685/695 Total
Skip 10 subtitle row
Done!

MSBigDataM02_mid
[##############################] - 98.25% - 562/572 Total
Skip 10 subtitle row
Done!

MSBigDataM03_mid
[##############################] - 98.98% - 970/980 Total
Skip 10 subtitle row
Done!

MSBigDataM04_mid
[##############################] - 97.68% - 421/431 Total
Skip 10 subtitle row
Done!

MSBigDataM05_mid
[##############################] - 98.93% - 922/932 Total
Skip 10 subtitle row
Done!

Elapsed time: 0:07:46.100000
Attached Thumbnails
Click image for larger version

Name:	image-00006.jpg
Views:	41
Size:	28.4 KB
ID:	118471   Click image for larger version

Name:	image-00007.jpg
Views:	37
Size:	25.0 KB
ID:	118472   Click image for larger version

Name:	image-00008.jpg
Views:	32
Size:	25.9 KB
ID:	118473   Click image for larger version

Name:	image-00009.jpg
Views:	34
Size:	27.3 KB
ID:	118474   Click image for larger version

Name:	image-00010.jpg
Views:	37
Size:	19.6 KB
ID:	118475  
Attached Files
File Type: zip video_lecture_to_img.zip (11.1 KB, 28 views)

Last edited by ppoo; 01-29-2014 at 09:26 AM. Reason: fix bug, add new image
ppoo is offline   Reply With Quote
Old 01-13-2014, 10:55 PM   #2
geekmaster
Всё гениальное просто.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 5,070
Karma: 6789001
Join Date: Nov 2011
Location: Щедрость не имеет пределов.
Device: *.*
You can also convert and play video on eink kindles with the geekmaster kindle video player. Look in the Native index wiki. But static images may be more readable for any lecture text, than dithered video, so this app may be more appropriate for some content.
geekmaster is offline   Reply With Quote
 
Advertisement
Old 01-14-2014, 02:09 AM   #3
thomass
Wizard
thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.
 
Posts: 1,643
Karma: 1928003
Join Date: Mar 2011
Location: Türkiye
Device: Kindle 5.3.7
a similar one here: http://www.frisnit.com/2011/07/07/iplayer-for-kindle/
thomass is offline   Reply With Quote
Old 01-14-2014, 11:15 AM   #4
ppoo
Connoisseur
ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.ppoo writes the songs that make the whole world sing.
 
Posts: 55
Karma: 40393
Join Date: May 2012
Device: Kindle Touch
@thomass: I've tried to google but can't find this result before you post ;(.
ppoo is offline   Reply With Quote
Old 01-15-2014, 03:47 AM   #5
thomass
Wizard
thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.
 
Posts: 1,643
Karma: 1928003
Join Date: Mar 2011
Location: Türkiye
Device: Kindle 5.3.7
Quote:
Originally Posted by ppoo View Post
@thomass: I've tried to google but can't find this result before you post ;(.
Thanks for sharing your work, it is nice to have alternatives. Also you may use the ideas in this project. Please continue on your project and let us know the updates (via this thread).
thomass is offline   Reply With Quote
Reply

Tags
image, kindle, video

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump


All times are GMT -4. The time now is 10:47 AM.


MobileRead.com is a privately owned, operated and funded community.