Estou escrevendo um programa que extrai imagens e coordenadas GPS de arquivos criados pelo gravador de vídeo do carro. Em muitos modelos, ele cria dois arquivos separados, vídeo e GPS, mas não todos, alguns gravadores gravam informações sobre coordenadas GPS em legendas de arquivos de vídeo. Então, eu enfrentei o problema de extrair legendas do arquivo de vídeo. Usando esse comando
d:\test\ffmpeg -i "d:\test\example_1.MOV" -an -vn -c:s copy -f rawvideo d:\test\sub.txt
Eu obtive legendas do arquivo "example_1.MOV", mas com outro arquivo "example_2.MOV" recebi a mensagem "O arquivo de saída # 0 não contém nenhum fluxo" O log completo é:
d:\test\ffmpeg -i "d:\test\example_2.MOV" -an -vn -codec:s copy -f rawvideo d:\test\sub2.txt
ffmpeg version N-56575-g21f6ff3 Copyright (c) 2000-2013 the FFmpeg developers
built on Sep 22 2013 18:02:01 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 46.100 / 52. 46.100
libavcodec 55. 33.100 / 55. 33.100
libavformat 55. 18.102 / 55. 18.102
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 87.100 / 3. 87.100
libswscale 2. 5.100 / 2. 5.100
libswresample 0. 17.103 / 0. 17.103
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'd:\test\example_2.MOV':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2014-03-30 16:05:10
comment : RELLA A7L
comment-pra : RELLA A7L
Duration: 00:02:34.72, start: 0.033367, bitrate: 9039 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc), 1280
x720 [SAR 1:1 DAR 16:9], 9014 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (de
fault)
Metadata:
creation_time : 2014-03-30 16:05:10
handler_name : Ambarella AVC
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 12
8 kb/s (default)
Metadata:
creation_time : 2014-03-30 16:05:10
handler_name : Ambarella AAC
Stream #0:2(eng): Data: none (RVMI / 0x494D5652), 0 kb/s
Metadata:
handler_name : GPS and G-Sensor
Output #0, rawvideo, to 'd:\test\sub2.txt':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
comment-pra : RELLA A7L
comment : RELLA A7L
Output file #0 does not contain any stream
Eu sei exatamente que esse arquivo tem legendas, então tentei descobrir quais fluxos esse arquivo contém usando o comando
d:\Test\ffprobe -show_streams -i "d:\test\example_2.MOV"
eu tenho essa informação
d:\test\ffprobe -show_streams -i "d:\test\example_2.
MOV"
ffprobe version N-64836-gce385c8 Copyright (c) 2007-2014 the FFmpeg developers
built on Jul 20 2014 23:42:59 with gcc 4.8.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw
b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
libavutil 52. 92.101 / 52. 92.101
libavcodec 55. 69.100 / 55. 69.100
libavformat 55. 48.101 / 55. 48.101
libavdevice 55. 13.102 / 55. 13.102
libavfilter 4. 11.102 / 4. 11.102
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'd:\test\example_2.MOV':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2014-03-30 16:05:10
comment : RELLA A7L
comment-pra : RELLA A7L
Duration: 00:02:34.72, start: 0.033367, bitrate: 9039 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc), 1280
x720 [SAR 1:1 DAR 16:9], 9014 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (de
fault)
Metadata:
creation_time : 2014-03-30 16:05:10
handler_name : Ambarella AVC
encoder : Ambarella AVC encoder
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 12
8 kb/s (default)
Metadata:
creation_time : 2014-03-30 16:05:10
handler_name : Ambarella AAC
Stream #0:2(eng): Data: none (RVMI / 0x494D5652), 0 kb/s
Metadata:
handler_name : GPS and G-Sensor
Unsupported codec with id 0 for input stream 2
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=Main
codec_type=video
codec_time_base=1001/60000
codec_tag_string=avc1
codec_tag=0x31637661
width=1280
height=720
has_b_frames=0
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuvj420p
level=31
color_range=pc
color_space=unknown
timecode=N/A
id=N/A
r_frame_rate=30000/1001
avg_frame_rate=30000/1001
time_base=1/30000
start_pts=-1001
start_time=-0.033367
duration_ts=4638634
duration=154.621133
bit_rate=9014524
max_bit_rate=N/A
nb_frames=4634
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
TAG:creation_time=2014-03-30 16:05:10
TAG:language=eng
TAG:handler_name=Ambarella AVC
TAG:encoder=Ambarella AVC encoder
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=unknown
codec_type=audio
codec_time_base=1/48000
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/48000
start_pts=0
start_time=0.000000
duration_ts=7421952
duration=154.624000
bit_rate=128000
max_bit_rate=N/A
nb_frames=7248
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
TAG:creation_time=2014-03-30 16:05:10
TAG:language=eng
TAG:handler_name=Ambarella AAC
[/STREAM]
[STREAM]
index=2
codec_name=unknown
codec_long_name=unknown
profile=unknown
codec_type=data
codec_time_base=0/1
codec_tag_string=RVMI
codec_tag=0x494d5652
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/50
start_pts=0
start_time=0.000000
duration_ts=7736
duration=154.720000
bit_rate=255
max_bit_rate=N/A
nb_frames=309
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
TAG:language=eng
TAG:handler_name= GPS and G-Sensor
[/STREAM]
Portanto, o ffmpeg não deseja extrair legendas deste arquivo. Ficaria feliz em receber sugestões de como extrair legendas do vídeo
ffmpeg
comando.