Tengo una transmisión de video que capturé VLC
y guardé como un archivo TS. Los códecs dentro del archivo son h.264/AAC, por lo que pensé que sería trivial usarlos ffmpeg
para convertir el archivo de un contenedor TS a un contenedor MP4, de modo que pueda reproducir el archivo en QuickTime. Utilicé el siguiente comando:
ffmpeg -i vlc-output.ts -acodec copy -vcodec copy car-free\ tourism.mp4
Todo parecía estar bien, pero aunque el archivo resultante se puede abrir en QuickTime, después de reproducir 1 segundo del archivo, vuelve al principio y luego reproduce solo el audio, con el video en negro. El video se reproduce bien en VLC y MPlayerX. No puedo entender por qué QuickTime no reproduce el archivo. Los códecs parecen compatibles y la longitud del archivo se ve bien. ¿Estoy haciendo algo mal? ¿Hay metadatos adicionales que QuickTime necesita?
De alguna manera sospecho que el problema radica en la falta de metadatos completos de tasa de bits, pero estoy fuera de mi alcance.
Gracias por cualquier ayuda.
La salida de ffprobe para ambos archivos es la siguiente:
vlc-salida.ts
[~/Desktop] 113: ffprobe vlc-output.ts 10:51:13
ffprobe version 3.3.3 Copyright (c) 2007-2017 the FFmpeg developers
built with Apple LLVM version 8.1.0 (clang-802.0.42)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-vda
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vlc-output.ts':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: mp41avc1
creation_time : 2015-06-23T20:48:30.000000Z
playback_requirements: QuickTime 6.0 or greater
playback_requirements-eng: QuickTime 6.0 or greater
encoder : vlc 2.2.1 stream output
encoder-eng : vlc 2.2.1 stream output
Duration: 00:01:50.09, start: 0.000000, bitrate: 1149 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x360, 1051 kb/s, 25 fps, 25 tbr, 1000k tbn, 50 tbc (default)
Metadata:
creation_time : 2015-06-23T20:48:30.000000Z
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 93 kb/s (default)
Metadata:
creation_time : 2015-06-23T20:48:30.000000Z
handler_name : SoundHandler
turismo sin coches.mp4
[~/Desktop] 114: ffprobe car-free\ tourism.mp4 10:51:36
ffprobe version 3.3.3 Copyright (c) 2007-2017 the FFmpeg developers
built with Apple LLVM version 8.1.0 (clang-802.0.42)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-vda
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'car-free tourism.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Duration: 00:01:50.09, start: 0.000000, bitrate: 1150 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x360, 1051 kb/s, 25 fps, 25 tbr, 1000k tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 93 kb/s (default)
Metadata:
handler_name : SoundHandler
Cuando uso la -report
opción cuando ejecuto el comando rewrap, obtengo el siguiente archivo de registro:
ffmpeg-20170824-164217.log
ffmpeg started on 2017-08-24 at 16:42:17
Report written to "ffmpeg-20170824-164217.log"
Command line:
ffmpeg -i vlc-output.ts -acodec copy -vcodec copy -report "car-free tourism.mp4"
ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 8.1.0 (clang-802.0.42)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-vda
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'vlc-output.ts'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'copy'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'copy'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option 'car-free tourism.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url vlc-output.ts.
Successfully parsed a group of options.
Opening an input file: vlc-output.ts.
[NULL @ 0x7f8f8e004200] Opening 'vlc-output.ts' for reading
[file @ 0x7f8f8ce00300] Setting default whitelist 'file,crypto'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8f8e004200] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8f8e004200] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8f8e004200] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8f8e004200] Processing st: 0, edit list 0 - media time: 0, duration: 109960000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8f8e004200] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8f8e004200] Processing st: 1, edit list 0 - media time: 0, duration: 4854784
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8f8e004200] Before avformat_find_stream_info() pos: 76497 bytes read:98304 seeks:0 nb_streams:2
[h264 @ 0x7f8f8e008400] nal_unit_type: 9, nal_ref_idc: 0
[h264 @ 0x7f8f8e008400] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x7f8f8e008400] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x7f8f8e008400] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 0x7f8f8e008400] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x7f8f8e008400] user data:"x264 - core 118 r2085 8a62835 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=5 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=36 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=50 keyint_min=25 scenecut=0 intra_refresh=0 rc_lookahead=40 rc=cbr mbtree=1 bitrate=1200 ratetol=1.0 qcomp=0.60 qpmin=10 qpmax=51 qpstep=4 vbv_maxrate=1200 vbv_bufsize=600 nal_hrd=none ip_ratio=1.40 aq=1:1.00"
[h264 @ 0x7f8f8e008400] Reinit context to 640x368, pix_fmt: yuv420p
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8f8e004200] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8f8e004200] After avformat_find_stream_info() pos: 99278 bytes read:131072 seeks:0 frames:2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vlc-output.ts':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: mp41avc1
creation_time : 2015-06-23T20:48:30.000000Z
playback_requirements: QuickTime 6.0 or greater
playback_requirements-eng: QuickTime 6.0 or greater
encoder : vlc 2.2.1 stream output
encoder-eng : vlc 2.2.1 stream output
Duration: 00:01:50.09, start: 0.000000, bitrate: 1149 kb/s
Stream #0:0(eng), 1, 1/1000000: Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x360, 1051 kb/s, 25 fps, 25 tbr, 1000k tbn, 50 tbc (default)
Metadata:
creation_time : 2015-06-23T20:48:30.000000Z
handler_name : VideoHandler
Stream #0:1(eng), 1, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 93 kb/s (default)
Metadata:
creation_time : 2015-06-23T20:48:30.000000Z
handler_name : SoundHandler
Successfully opened the file.
Parsing a group of options: output url car-free tourism.mp4.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument copy.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument copy.
Successfully parsed a group of options.
Opening an output file: car-free tourism.mp4.
[file @ 0x7f8f8ce04fe0] Setting default whitelist 'file,crypto'
Successfully opened the file.
Output #0, mp4, to 'car-free tourism.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: mp41avc1
encoder : Lavf57.71.100
playback_requirements: QuickTime 6.0 or greater
playback_requirements-eng: QuickTime 6.0 or greater
Stream #0:0(eng), 0, 1/1000000: Video: h264 (Main) ([33][0][0][0] / 0x0021), yuv420p, 640x360, q=2-31, 1051 kb/s, 25 fps, 25 tbr, 1000k tbn, 1000k tbc (default)
Metadata:
creation_time : 2015-06-23T20:48:30.000000Z
handler_name : VideoHandler
Stream #0:1(eng), 0, 1/44100: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 93 kb/s (default)
Metadata:
creation_time : 2015-06-23T20:48:30.000000Z
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
No more output streams to write to, finishing.
frame= 2749 fps=0.0 q=-1.0 Lsize= 15455kB time=00:01:50.04 bitrate=1150.5kbits/s speed= 588x
video:14120kB audio:1258kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.503515%
Input file #0 (vlc-output.ts):
Input stream #0:0 (video): 2749 packets read (14459053 bytes);
Input stream #0:1 (audio): 4741 packets read (1287842 bytes);
Total: 7490 packets (15746895 bytes) demuxed
Output file #0 (car-free tourism.mp4):
Output stream #0:0 (video): 2749 packets muxed (14459053 bytes);
Output stream #0:1 (audio): 4741 packets muxed (1287842 bytes);
Total: 7490 packets (15746895 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x7f8f8ce050a0] Statistics: 60 seeks, 7583 writeouts
[AVIOContext @ 0x7f8f8ce00480] Statistics: 16617055 bytes read, 17 seeks
El archivo de video que estoy tratando de volver a empaquetar es un flujo de noticias de STV especificado en un archivo m3u8, que capturé con VLC. He puesto una copia aquí .
Actualización : el VLC TS está mal formado.
Primer intento
ffmpeg -i vlc-output.ts -c copy ffmpeg-output.ts
y entonces
ffmpeg -i ffmpeg-output.ts -c copy working.mp4
Lo principal que se ve mal es la base de tiempo 1000k tbn
.
Intentar
ffmpeg -i vlc-output.ts -c copy -video_track_timescale 90k car-free\ tourism.mp4
jzw
90k tbn
:Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x360, 1051 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
gian
jzw
-report
opción produce un archivo de registro (no lo había visto antes), así que actualicé la pregunta con el contenido de este archivo desde la primera vez que me pidió que ejecutara el ajuste con un informe. ¿Quizás el contenido de ese archivo podría ayudar a identificar qué está pasando? Realmente aprecio su ayuda, gracias.jzw
gian
ffmpeg -ss 30 -i vlc-output.ts -c copy -video_track_timescale 600 -report car-free\ tourism.mp4
Si funciona, intente con valores de ss más bajos hasta que aún funcione.jzw
-ss 60
y-ss 90
también, y obtuve exactamente el mismo resultado (excepto que el audio obviamente comienza en 60 y 90, y la duración total es más corta). ¿Algo más que pueda probar?gian
jzw
jzw