更新: 下部の編集セクションを参照してください
オプションを設定するか、出力を処理することで、ffmpeg からのコンソール出力を制限する方法はありますか? ドキュメントを見て、出力を制限するオプションを設定しましたが、さらに制限できる他の方法があることを願っています。また、ffmpeg の冗長性に関する次のような投稿も見ました。これ-loglevel オプションについては説明されていますが、十分な制御は提供されていません。
以下は、-loglevel error オプションを使用して出力を完全に無音にすることなく取得できる最も詳細度の低い出力ですが、これは私が望んでいるものではありません。
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
そして、これが私が理想的に望んでいるものです:
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
ffmpeg でこれを行う方法がない場合は、出力から不要なテキストをすべてフィルター処理する方法の例を誰かが提供してくれるとありがたいです。
編集: grep を使用するという提案に従って、ほぼ目的を達成できるこの方法を思いつきました。残る唯一の問題は、grep によって進行状況が連続した新しい行に表示されるため、それをフィルタリングできなかったことです。
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=.*"
出力は次のようになります:
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
答え1
独自のレベルのログ記録を作成したいので、自分で行う必要があります。
たとえば、次のようなものを使用できます。
unbuffer ffmpeg … | unbuffer grep PATTERN
ここで、PATTERN は、通過させる出力行を定義する正規表現です。