업데이트: 하단의 편집 섹션을 참조하세요.
옵션을 설정하거나 출력을 처리하여 ffmpeg에서 콘솔 출력을 제한하는 방법이 있습니까? 문서를 살펴보고 출력을 제한하는 사용 가능한 옵션을 설정했지만 출력을 더 제한할 수 있는 다른 방법이 있을 수 있기를 바랍니다. 나는 또한 다음과 같은 ffmpeg 자세한 내용에 대해 찾을 수 있는 게시물을 살펴보았습니다.이것-loglevel 옵션을 논의하지만 충분한 제어를 제공하지 않습니다.
다음은 -loglevel 오류 옵션을 사용하여 출력을 완전히 침묵시키지 않고 얻을 수 있는 가장 자세한 출력입니다. 이는 제가 원하는 것이 아닙니다.
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은 통과하려는 출력 라인을 정의하는 정규식입니다.