ACTUALIZACIÓN: consulte la sección EDITAR en la parte inferior
¿Hay alguna manera de limitar la salida de la consola desde ffmpeg configurando opciones o procesando la salida? Revisé la documentación y configuré las opciones disponibles que limitan la salida, pero espero que haya otros métodos que sean posibles para limitarla aún más. También miré las publicaciones que pude encontrar sobre la verbocidad de ffmpeg, comoesteque analizan la opción -loglevel, pero no proporciona suficiente control.
Aquí está el resultado menos detallado que puedo obtener sin silenciar el resultado por completo usando la opción de error -loglevel, que no es lo que quiero.
ffmpeg -hide_banner -i input.mkv -c:v libx265 -crf 26 -x265-params log-level=error -vtag hvc1 -c:a ac3 -c:s mov_text output.mp4
Input #0, matroska,webm, from './input.mkv':
Metadata:
encoder : no_variable_data
creation_time : 1970-01-01T00:00:00.000000Z
Duration: 00:48:46.48, start: 0.000000, bitrate: 9619 kb/s
Chapter #0:0: start 0.000000, end 326.409000
Metadata:
title : 00:00:00.000
Chapter #0:1: start 326.409000, end 1037.912000
Metadata:
title : 00:05:26.409
Chapter #0:2: start 1037.912000, end 1516.640000
Metadata:
title : 00:17:17.912
Chapter #0:3: start 1516.640000, end 2359.732000
Metadata:
title : 00:25:16.640
Chapter #0:4: start 2359.732000, end 2887.009000
Metadata:
title : 00:39:19.732
Chapter #0:5: start 2887.009000, end 2926.475000
Metadata:
title : 00:48:07.009
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Metadata:
BPS : 8107717
BPS-eng : 8107717
DURATION : 00:48:46.466000000
DURATION-eng : 00:48:46.466000000
NUMBER_OF_FRAMES: 70165
NUMBER_OF_FRAMES-eng: 70165
NUMBER_OF_BYTES : 2965869890
NUMBER_OF_BYTES-eng: 2965869890
_STATISTICS_WRITING_APP: no_variable_data
_STATISTICS_WRITING_APP-eng: no_variable_data
_STATISTICS_WRITING_DATE_UTC: 1970-01-01 00:00:00
_STATISTICS_WRITING_DATE_UTC-eng: 1970-01-01 00:00:00
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:1(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)
Metadata:
BPS : 1508999
BPS-eng : 1508999
DURATION : 00:48:46.475000000
DURATION-eng : 00:48:46.475000000
NUMBER_OF_FRAMES: 274357
NUMBER_OF_FRAMES-eng: 274357
NUMBER_OF_BYTES : 552006284
NUMBER_OF_BYTES-eng: 552006284
_STATISTICS_WRITING_APP: no_variable_data
_STATISTICS_WRITING_APP-eng: no_variable_data
_STATISTICS_WRITING_DATE_UTC: 1970-01-01 00:00:00
_STATISTICS_WRITING_DATE_UTC-eng: 1970-01-01 00:00:00
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:2(eng): Subtitle: subrip (default) (forced)
Metadata:
title : Forced
BPS : 105
BPS-eng : 105
DURATION : 00:00:18.518000000
DURATION-eng : 00:00:18.518000000
NUMBER_OF_FRAMES: 6
NUMBER_OF_FRAMES-eng: 6
NUMBER_OF_BYTES : 245
NUMBER_OF_BYTES-eng: 245
_STATISTICS_WRITING_APP: no_variable_data
_STATISTICS_WRITING_APP-eng: no_variable_data
_STATISTICS_WRITING_DATE_UTC: 1970-01-01 00:00:00
_STATISTICS_WRITING_DATE_UTC-eng: 1970-01-01 00:00:00
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:3(eng): Subtitle: subrip
Metadata:
BPS : 61
BPS-eng : 61
DURATION : 00:47:20.754000000
DURATION-eng : 00:47:20.754000000
NUMBER_OF_FRAMES: 584
NUMBER_OF_FRAMES-eng: 584
NUMBER_OF_BYTES : 21796
NUMBER_OF_BYTES-eng: 21796
_STATISTICS_WRITING_APP: no_variable_data
_STATISTICS_WRITING_APP-eng: no_variable_data
_STATISTICS_WRITING_DATE_UTC: 1970-01-01 00:00:00
_STATISTICS_WRITING_DATE_UTC-eng: 1970-01-01 00:00:00
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:4(eng): Subtitle: subrip
Metadata:
title : SDH
BPS : 62
BPS-eng : 62
DURATION : 00:48:07.176000000
DURATION-eng : 00:48:07.176000000
NUMBER_OF_FRAMES: 619
NUMBER_OF_FRAMES-eng: 619
NUMBER_OF_BYTES : 22653
NUMBER_OF_BYTES-eng: 22653
_STATISTICS_WRITING_APP: no_variable_data
_STATISTICS_WRITING_APP-eng: no_variable_data
_STATISTICS_WRITING_DATE_UTC: 1970-01-01 00:00:00
_STATISTICS_WRITING_DATE_UTC-eng: 1970-01-01 00:00:00
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
Stream #0:1 -> #0:1 (dts (dca) -> ac3 (native))
Stream #0:2 -> #0:2 (subrip (srt) -> mov_text (native))
Press [q] to stop, [?] for help
Output #0, mp4, to './output.mp4':
Chapter #0:0: start 0.000000, end 326.409000
Metadata:
title : 00:00:00.000
Chapter #0:1: start 326.409000, end 1037.912000
Metadata:
title : 00:05:26.409
Chapter #0:2: start 1037.912000, end 1516.640000
Metadata:
title : 00:17:17.912
Chapter #0:3: start 1516.640000, end 2359.732000
Metadata:
title : 00:25:16.640
Chapter #0:4: start 2359.732000, end 2887.009000
Metadata:
title : 00:39:19.732
Chapter #0:5: start 2887.009000, end 2926.475000
Metadata:
title : 00:48:07.009
Stream #0:0: Video: hevc (libx265) (hvc1 / 0x31637668), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 24k tbn, 23.98 tbc (default)
Metadata:
BPS : 8107717
BPS-eng : 8107717
DURATION : 00:48:46.466000000
DURATION-eng : 00:48:46.466000000
NUMBER_OF_FRAMES: 70165
NUMBER_OF_FRAMES-eng: 70165
NUMBER_OF_BYTES : 2965869890
NUMBER_OF_BYTES-eng: 2965869890
_STATISTICS_WRITING_APP: no_variable_data
_STATISTICS_WRITING_APP-eng: no_variable_data
_STATISTICS_WRITING_DATE_UTC: 1970-01-01 00:00:00
_STATISTICS_WRITING_DATE_UTC-eng: 1970-01-01 00:00:00
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
encoder : Lavc libx265
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
Metadata:
BPS : 1508999
BPS-eng : 1508999
DURATION : 00:48:46.475000000
DURATION-eng : 00:48:46.475000000
NUMBER_OF_FRAMES: 274357
NUMBER_OF_FRAMES-eng: 274357
NUMBER_OF_BYTES : 552006284
NUMBER_OF_BYTES-eng: 552006284
_STATISTICS_WRITING_APP: no_variable_data
_STATISTICS_WRITING_APP-eng: no_variable_data
_STATISTICS_WRITING_DATE_UTC: 1970-01-01 00:00:00
_STATISTICS_WRITING_DATE_UTC-eng: 1970-01-01 00:00:00
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
encoder : Lavc ac3
Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874) (default) (forced)
Metadata:
title : Forced
BPS : 105
BPS-eng : 105
DURATION : 00:00:18.518000000
DURATION-eng : 00:00:18.518000000
NUMBER_OF_FRAMES: 6
NUMBER_OF_FRAMES-eng: 6
NUMBER_OF_BYTES : 245
NUMBER_OF_BYTES-eng: 245
_STATISTICS_WRITING_APP: no_variable_data
_STATISTICS_WRITING_APP-eng: no_variable_data
_STATISTICS_WRITING_DATE_UTC: 1970-01-01 00:00:00
_STATISTICS_WRITING_DATE_UTC-eng: 1970-01-01 00:00:00
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
encoder : Lavc mov_text
frame= 1047 fps= 58 q=33.7 size= 2560kB time=00:00:44.37 bitrate= 472.6kbits/s speed=2.48x
Y esto es lo que idealmente me gustaría tener:
ffmpeg -hide_banner -i input.mkv -c:v libx265 -crf 26 -x265-params log-level=error -vtag hvc1 -c:a ac3 -c:s mov_text output.mp4
Input #0, matroska,webm, from './input.mkv':
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Stream #0:1(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)
Stream #0:2(eng): Subtitle: subrip (default) (forced)
Stream #0:3(eng): Subtitle: subrip
Stream #0:4(eng): Subtitle: subrip
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
Stream #0:1 -> #0:1 (dts (dca) -> ac3 (native))
Stream #0:2 -> #0:2 (subrip (srt) -> mov_text (native))
Press [q] to stop, [?] for help
Output #0, mp4, to './output.mp4':
Stream #0:0: Video: hevc (libx265) (hvc1 / 0x31637668), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 24k tbn, 23.98 tbc (default)
Stream #0:1(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874) (default) (forced)
frame= 1047 fps= 58 q=33.7 size= 2560kB time=00:00:44.37 bitrate= 472.6kbits/s speed=2.48x
Si no hay forma de hacer esto con ffmpeg, sería fantástico si alguien pudiera dar un ejemplo sobre cómo filtrar todo el texto innecesario de la salida.
EDITAR: Siguiendo la sugerencia de usar grep, se me ocurrió esto que me lleva casi allí. El único problema restante es que grep hace que el progreso aparezca en nuevas líneas continuas y no he podido filtrar eso.
ffmpeg -progress pipe:1 -i input.mkv -c:v libx265 -vtag hvc1 -c:a copy -c:s mov_text output.mp4 2>&1 | egrep "Input.*|Duration.*|Stream.*|Output.*|frame=.*"
Da esta salida:
Input #0, matroska,webm, from './input.mkv':
Duration: 00:43:04.59, start: 0.000000, bitrate: 7253 kb/s
Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Stream #0:1(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)
Stream #0:2(eng): Subtitle: subrip (default) (forced)
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
Stream #0:1 -> #0:1 (copy)
Stream #0:2 -> #0:2 (subrip (srt) -> mov_text (native))
Output #0, mp4, to '/output.mp4':
Stream #0:0(eng): Video: hevc (libx265) (hvc1 / 0x31637668), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 13978 tbn, 23.98 tbc (default)
Stream #0:1(eng): Audio: dts (DTS) (mp4a / 0x6134706D), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)
Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874) (default) (forced)
frame=92 92 fps=0.0 q=29.8 size= 0kB time=00:00:04.52 bitrate= 0.4kbits/s speed=9.01x
frame=17676 fps=174 q=31.2 size= 0kB time=00:00:08.04 bitrate= 0.3kbits/s speed=7.94x
frame=25555 fps=168 q=35.8 size= 256kB time=00:00:11.38 bitrate= 184.4kbits/s speed=7.48x
frame=29191 fps=143 q=34.4 size= 512kB time=00:00:12.88 bitrate= 325.7kbits/s speed=6.34x
Respuesta1
Como desea crear su propio nivel de registro, deberá hacerlo usted mismo.
Por ejemplo, podrías usar algo como:
unbuffer ffmpeg … | unbuffer grep PATTERN
donde PATRÓN es una expresión regular que define las líneas de salida que desea pasar.