2

Current Status: I have a movie I recorded on a microscopy and a .txt file with two columns: time and temperature. This file is synchronous with the video. I would like to 'edit' the video so there is a text box with the temperature that would update as the movie plays.

My approach, for the moment, is to use ffmpeg. I managed to draw some text and it seems all is working as intended.

The problem is: I can't find any reference on how to update that text dynamically. I am using some Python to read the file and launch ffmpeg with subprocess.

I would like to ask if anyone knows some workaround for this. Maybe some other approach.

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
Hugo
  • 557
  • 4
  • 13
  • So you need help dynamically updating your text file with python? How do you want to dynamically update it? Try to make your question more specific and answerable. – Eric Leschinski Dec 12 '12 at 02:39
  • 4
    sounds like a subtitle problem to me? If you have all the text timestamped properly, you can convert them into .srt and play together with the movie, better still you can choose to turn it on/off :) – drhanlau Dec 12 '12 at 02:40
  • @EricLeschinski I think you misunderstood me. I don't want to update the text file. The text file is complete and has the temperature readings as function of time in intervals of 500ms. Now, these times corresponds to video time. I want to show the temperature variations on video. Much like a subtitle, yes. Which leads us to... – Hugo Dec 12 '12 at 12:12
  • @cherhan, I thought of making a .srt file and it seemed obvious to me, but I discarded it because then I didn't know if it was possible to embed the video into a slide presentation with subtitles showing up. I guess I'll have to try this. Meanwhile, if someone knows if it is possible to do it in ffmpeg, like editing a particular frame/time and add different text along all video, please post. – Hugo Dec 12 '12 at 12:12

1 Answers1

2

pysrt - Python module to create .srt files

Building on what @cherhan said, consider using the pysrt library.

You can find the library here: http://pypi.python.org/pypi/pysrt/0.2.2

If you have problems using the library, comment below and maybe I can write some code to demonstrate how it would be used in this particular situation (although I feel that the problem is trivial at this point).

Shariq
  • 581
  • 1
  • 5
  • 12
  • I didn't know about this library. I'll give it a try and see if it helps. – Hugo Dec 12 '12 at 12:14
  • I managed to make it. I hope this method can get me to where I want. Anyway, can you give an example on how to customize these subtitles, mainly position? Can't find any example on that. – Hugo Dec 13 '12 at 11:13