Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically extract .SRT subtitles from video files when possible #1586

Open
pierotofy opened this issue Jan 25, 2023 · 2 comments
Open

Automatically extract .SRT subtitles from video files when possible #1586

pierotofy opened this issue Jan 25, 2023 · 2 comments

Comments

@pierotofy
Copy link
Member

pierotofy commented Jan 25, 2023

Some video files (e.g. those made by newer DJI drones) have a textual track optionally saved along with video files. One can extract the corresponding .SRT file via:

ffmpeg -i video.mp4 -o video.srt

It would be nicer if ODM could do this automatically without calling/adding ffmpeg as a dependency, we already compile ffmpeg within OpenCV, so it should be a matter of finding out which routines to call within the compiled ffmpeg library to extract the SRT data.

@pierotofy
Copy link
Member Author

No way to do this directly with OpenCV on Windows, as the binary shipped with Windows does not expose anything other than the OCV FFMPEG Capture interface code.

On Linux we already have avcodec and avformat so we could build something like this https://gist.github.com/pierotofy/12038d4b1674444b1707be880c8ce4c8 to extract the SRT, although it requires more code to be stable and imitate the ffmpeg binary.

On Windows we could build a separate binary, but it would still weight a few dozen MB.

Including the ffmpeg executable (a minimal build perhaps) might be the way to go.

@vinsonliux
Copy link

hi,I couldn't export the subtitle file with the ffmpeg command you provided, I ended up using the following code
ffmpeg -i DJI_0289.MOV -map 0:s:0 DJI_0289.srt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants