[FFmpeg-user] synching multilingual subtitles using ffmpeg ...
Albretch Mueller
lbrtchx at gmail.com
Fri Oct 19 16:24:37 CEST 2012
> www.videohelp.com has a wealth of further information on subtitles
~
I did check the "information" on subtitles on videohelp:
~
http://www.videohelp.com/guides/category/how-to-add-subtitles-to-a-video-5;20#5;20
~
and all they are saying is how to do this and that with such and such
"tool". There is a reason why I came here to the ffmpeg-user list
~
Using ffprobe and avconv you can get most of the metadata you need,
but my question is how -using the ffmpeg library- can I get to the
timing/synching metadata in order to anchor a text transcript file?
~
> ... in others you need to author the subtitles yourself from scratch.
> In its most basic form subtitle source is a text transcript file containing spoken utterances only.
~
most cases would be like that. In fact, the need to have an option to
annotate the text transcripts may come in the future
~
> A timed subtitle file contains time/frame count references which enable a player or other rendering tools to synchronise it with the target video/audio.
~
Exactly what I need to get into. You can use ffprobe and ffmpeg to
get the metadata inside media files
~
If you:
1) click on the (lower next to "Embed") button, and then
2) select the subtitle's language
~
you will be able to download the files to your desktop of whichever
languages you would like to use as use cases, as low-, standard- and
high-resolution
~
$ for f in $(ls *.mp4); do ls -l $f; done
-rw-r--r-- 1 knoppix knoppix 137364305 Sep 21 16:37
JulianAssange_2010G-480p-de.mp4
-rw-r--r-- 1 knoppix knoppix 137365468 Sep 21 16:39
JulianAssange_2010G-480p-en.mp4
-rw-r--r-- 1 knoppix knoppix 137373997 Sep 21 16:40
JulianAssange_2010G-480p-es.mp4
-rw-r--r-- 1 knoppix knoppix 137357591 Nov 29 2011 JulianAssange_2010G-480p.mp4
-rw-r--r-- 1 knoppix knoppix 10192540 Nov 29 2011 JulianAssange_2010G-light.mp4
-rw-r--r-- 1 knoppix knoppix 27429977 Sep 21 17:18
JulianAssange_2010G-low-de.mp4
-rw-r--r-- 1 knoppix knoppix 27466594 Sep 21 17:19
JulianAssange_2010G-low-en.mp4
-rw-r--r-- 1 knoppix knoppix 26562886 Sep 21 17:19
JulianAssange_2010G-low-es.mp4
-rw-r--r-- 1 knoppix knoppix 67130316 Nov 29 2011 JulianAssange_2010G.mp4
~
then you may get the metadata info of each othe media files
~
for f in $(ls *.mp4); do
ffprobe -unit -show_streams -show_format -loglevel debug $f > $f".log" 2>&1
done
~
$ ls -l *.log
-rw-r--r-- 1 knoppix knoppix 5096 Oct 19 09:53
JulianAssange_2010G-480p-de.mp4.log
-rw-r--r-- 1 knoppix knoppix 5196 Oct 19 09:53
JulianAssange_2010G-480p-en.mp4.log
-rw-r--r-- 1 knoppix knoppix 5108 Oct 19 09:53
JulianAssange_2010G-480p-es.mp4.log
-rw-r--r-- 1 knoppix knoppix 4392 Oct 19 09:53 JulianAssange_2010G-480p.mp4.log
-rw-r--r-- 1 knoppix knoppix 4363 Oct 19 09:53 JulianAssange_2010G-light.mp4.log
-rw-r--r-- 1 knoppix knoppix 5067 Oct 19 09:53
JulianAssange_2010G-low-de.mp4.log
-rw-r--r-- 1 knoppix knoppix 5167 Oct 19 09:53
JulianAssange_2010G-low-en.mp4.log
-rw-r--r-- 1 knoppix knoppix 5079 Oct 19 09:53
JulianAssange_2010G-low-es.mp4.log
-rw-r--r-- 1 knoppix knoppix 4355 Oct 19 09:53 JulianAssange_2010G.mp4.log
~
$ wc -l *.log
119 JulianAssange_2010G-480p-de.mp4.log
115 JulianAssange_2010G-480p-en.mp4.log
119 JulianAssange_2010G-480p-es.mp4.log
113 JulianAssange_2010G-480p.mp4.log
112 JulianAssange_2010G-light.mp4.log
118 JulianAssange_2010G-low-de.mp4.log
114 JulianAssange_2010G-low-en.mp4.log
118 JulianAssange_2010G-low-es.mp4.log
112 JulianAssange_2010G.mp4.log
1040 total
~
$ cat JulianAssange_2010G-480p.mp4.log | egrep "bit_rate|sample_rate|channels"
sample_rate=44100.000000 Hz
channels=2
bit_rate=936033.000000 bit/s
$ date; avconv -i JulianAssange_2010G-480p.mp4 -b 936145 -ac 2 -ar
44100 -vn JulianAssange_2010G-480p.mp3; date
Fri Oct 19 10:10:20 UTC 2012
avconv version 0.8.2-6:0.8.2-2, Copyright (c) 2000-2011 the Libav developers
built on May 16 2012 19:58:09 with gcc 4.7.0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'JulianAssange_2010G-480p.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
creation_time : 2011-11-28 18:05:52
media_type : 0
title : TED: Julian Assange (2010 Global)
artist : TED
date : 2010
album : TEDTalks
comment : To learn more about this speaker, find other
TEDTalks, and subscribe to this Podcast series, visit www.TED.com
Feedback: contact at ted.com
genre : Podcast
Duration: 00:19:33.95, start: 0.000000, bitrate: 936 kb/s
Stream #0.0(und): Video: h264 (Main), yuv420p, 854x480 [PAR
1280:1281 DAR 16:9], 854 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 2011-08-05 17:25:35
Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16, 74 kb/s
Metadata:
creation_time : 2011-11-28 18:05:56
Output #0, mp3, to 'JulianAssange_2010G-480p.mp3':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
TDEN : 2011-11-28 18:05:52
media_type : 0
TIT2 : TED: Julian Assange (2010 Global)
TPE1 : TED
TDRL : 2010
TALB : TEDTalks
comment : To learn more about this speaker, find other
TEDTalks, and subscribe to this Podcast series, visit www.TED.com
Feedback: contact at ted.com
TCON : Podcast
TSSE : Lavf53.21.0
Stream #0.0(und): Audio: libmp3lame, 44100 Hz, stereo, s16, 936 kb/s
Metadata:
creation_time : 2011-11-28 18:05:56
Stream mapping:
Stream #0:1 -> #0:0 (aac -> libmp3lame)
Press ctrl-c to stop encoding
size= 45860kB time=1174.00 bitrate= 320.0kbits/s
video:0kB audio:45859kB global headers:0kB muxing overhead 0.001175%
Fri Oct 19 10:11:13 UTC 2012
~
$ cat JulianAssange_2010G-light.mp4.log | egrep "bit_rate|sample_rate|channels"
sample_rate=24000.000000 Hz
channels=1
bit_rate=69447.000000 bit/s
$ date; avconv -i JulianAssange_2010G-light.mp4 -b 69447 -ac 1 -ar
24000 -vn JulianAssange_2010G-light.mp3; date
Fri Oct 19 10:14:03 UTC 2012
avconv version 0.8.2-6:0.8.2-2, Copyright (c) 2000-2011 the Libav developers
built on May 16 2012 19:58:09 with gcc 4.7.0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'JulianAssange_2010G-light.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
creation_time : 2011-11-28 18:05:53
media_type : 0
title : TED: Julian Assange (2010 Global)
artist : TED
date : 2010
album : TEDTalks
comment : To learn more about this speaker, find other
TEDTalks, and subscribe to this Podcast series, visit www.TED.com
Feedback: contact at ted.com
genre : Podcast
Duration: 00:19:34.12, start: 0.153846, bitrate: 69 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p,
320x180 [PAR 1:1 DAR 16:9], 40 kb/s, 13 fps, 13 tbr, 13 tbn, 26 tbc
Metadata:
creation_time : 2011-08-05 17:25:34
Stream #0.1(und): Audio: aac, 24000 Hz, mono, s16, 23 kb/s
Metadata:
creation_time : 2011-11-28 18:05:59
[mp3 @ 0x8088fc0] Unsupported sample rate.
Output #0, mp3, to 'JulianAssange_2010G-light.mp3':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
TDEN : 2011-11-28 18:05:53
media_type : 0
TIT2 : TED: Julian Assange (2010 Global)
TPE1 : TED
TDRL : 2010
TALB : TEDTalks
comment : To learn more about this speaker, find other
TEDTalks, and subscribe to this Podcast series, visit www.TED.com
Feedback: contact at ted.com
TCON : Podcast
TSSE : Lavf53.21.0
Stream #0.0(und): Audio: libmp3lame, 24000 Hz, mono, s16, 69 kb/s
Metadata:
creation_time : 2011-11-28 18:05:59
Stream mapping:
Stream #0:1 -> #0:0 (aac -> libmp3lame)
Press ctrl-c to stop encoding
size= 9173kB time=1174.03 bitrate= 64.0kbits/s
video:0kB audio:9172kB global headers:0kB muxing overhead 0.004770%
Fri Oct 19 10:14:22 UTC 2012
~
the only thing I could get from the output was for the light res file:
~
[mp3 @ 0x8088fc0] Unsupported sample rate.
~
thanks
lbrtchx
More information about the ffmpeg-user
mailing list