ffmpeg로 "silence.txt"라는 출력 파일을 생성합니다. "silencedetect"라는 단어가 포함 된 줄을 추출하려고하면 이상한 추출물이 나옵니다.
여기 내 원래 "silence.txt"파일이 있습니다.
ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.6.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1_1/include/openjpeg-1.5 ' --enable-nonfree --enable-vda
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test4.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: mp41avc1
creation_time : 2015-06-20 22:41:18
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:05:25.93, start: 0.000000, bitrate: 1761 kb/s
Stream #0:0(fra): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2015-06-20 22:41:18
handler_name : SoundHandler
Stream #0:1(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 1625 kb/s, 24.96 fps, 25 tbr, 1000k tbn, 50 tbc (default)
Metadata:
creation_time : 2015-06-20 22:41:18
handler_name : VideoHandler
Output #0, null, to 'pipe:':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: mp41avc1
encoder : Lavf56.25.101
playback_requirements: QuickTime 6.0 or greater
playback_requirements-eng: QuickTime 6.0 or greater
Stream #0:0(eng): Video: rawvideo (I420 / 0x30323449), yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
Metadata:
creation_time : 2015-06-20 22:41:18
handler_name : VideoHandler
encoder : Lavc56.26.100 rawvideo
Stream #0:1(fra): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
Metadata:
creation_time : 2015-06-20 22:41:18
handler_name : SoundHandler
encoder : Lavc56.26.100 pcm_s16le
Stream mapping:
Stream #0:1 -> #0:0 (h264 (native) -> rawvideo (native))
Stream #0:0 -> #0:1 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[null @ 0x7feb4b810600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 993 >= 993
[null @ 0x7feb4b810600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 5602 >= 5602
frame= 139 fps=0.0 q=0.0 size=N/A time=00:00:07.03 bitrate=N/A
frame= 316 fps=311 q=0.0 size=N/A time=00:00:14.11 bitrate=N/A
[null @ 0x7feb4b810600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 734723 >= 734723
[silencedetect @ 0x7feb4b40d9e0] silence_start: 15.056
[silencedetect @ 0x7feb4b40d9e0] silence_end: 15.6482 | silence_duration: 0.592229
frame= 488 fps=321 q=0.0 size=N/A time=00:00:21.04 bitrate=N/A
frame= 631 fps=312 q=0.0 size=N/A time=00:00:26.75 bitrate=N/A
[null @ 0x7feb4b810600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 1476678 >= 1476678
[silencedetect @ 0x7feb4b40d9e0] silence_start: 30.5347
[silencedetect @ 0x7feb4b40d9e0] silence_end: 31.0626 | silence_duration: 0.527958
frame= 839 fps=333 q=0.0 size=N/A time=00:00:34.08 bitrate=N/A
frame= 975 fps=322 q=0.0 size=N/A time=00:00:39.52 bitrate=N/A
frame= 1150 fps=325 q=0.0 size=N/A time=00:00:46.52 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 54.051
[silencedetect @ 0x7feb4b40d9e0] silence_end: 54.5362 | silence_duration: 0.485292
frame= 1366 fps=339 q=0.0 size=N/A time=00:00:55.16 bitrate=N/A
frame= 1505 fps=332 q=0.0 size=N/A time=00:01:00.72 bitrate=N/A
frame= 1645 fps=327 q=0.0 size=N/A time=00:01:06.32 bitrate=N/A
frame= 1780 fps=321 q=0.0 size=N/A time=00:01:11.72 bitrate=N/A
frame= 1957 fps=324 q=0.0 size=N/A time=00:01:18.80 bitrate=N/A
[null @ 0x7feb4b810600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 4067886 >= 4067886
[silencedetect @ 0x7feb4b40d9e0] silence_start: 84.4542
[silencedetect @ 0x7feb4b40d9e0] silence_end: 85.4725 | silence_duration: 1.01831
frame= 2150 fps=329 q=0.0 size=N/A time=00:01:26.52 bitrate=N/A
frame= 2289 fps=325 q=0.0 size=N/A time=00:01:32.08 bitrate=N/A
frame= 2460 fps=326 q=0.0 size=N/A time=00:01:38.92 bitrate=N/A
frame= 2584 fps=321 q=0.0 size=N/A time=00:01:43.88 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 104.986
[null @ 0x7feb4b810600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 5058544 >= 5058544
[silencedetect @ 0x7feb4b40d9e0] silence_end: 105.482 | silence_duration: 0.495979
frame= 2763 fps=323 q=0.0 size=N/A time=00:01:51.04 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 115.327
[null @ 0x7feb4b810600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 5557968 >= 5557968
[silencedetect @ 0x7feb4b40d9e0] silence_end: 115.983 | silence_duration: 0.656042
frame= 2939 fps=324 q=0.0 size=N/A time=00:01:58.08 bitrate=N/A
frame= 3101 fps=324 q=0.0 size=N/A time=00:02:04.56 bitrate=N/A
frame= 3264 fps=324 q=0.0 size=N/A time=00:02:11.08 bitrate=N/A
frame= 3474 fps=329 q=0.0 size=N/A time=00:02:19.48 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 138.695
[null @ 0x7feb4b810600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 6679615 >= 6679615
[silencedetect @ 0x7feb4b40d9e0] silence_end: 139.415 | silence_duration: 0.719875
frame= 3636 fps=328 q=0.0 size=N/A time=00:02:25.96 bitrate=N/A
[null @ 0x7feb4b810600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 7178004 >= 7178004
[silencedetect @ 0x7feb4b40d9e0] silence_start: 149.206
[silencedetect @ 0x7feb4b40d9e0] silence_end: 149.883 | silence_duration: 0.677187
frame= 3811 fps=329 q=0.0 size=N/A time=00:02:32.96 bitrate=N/A
frame= 3968 fps=329 q=0.0 size=N/A time=00:02:39.24 bitrate=N/A
frame= 4132 fps=329 q=0.0 size=N/A time=00:02:45.80 bitrate=N/A
frame= 4296 fps=329 q=0.0 size=N/A time=00:02:52.36 bitrate=N/A
frame= 4492 fps=331 q=0.0 size=N/A time=00:03:00.28 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 179.842
[null @ 0x7feb4b810600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 8652662 >= 8652662
[silencedetect @ 0x7feb4b40d9e0] silence_end: 180.44 | silence_duration: 0.597313
frame= 4655 fps=331 q=0.0 size=N/A time=00:03:06.80 bitrate=N/A
frame= 4821 fps=331 q=0.0 size=N/A time=00:03:13.44 bitrate=N/A
frame= 4985 fps=330 q=0.0 size=N/A time=00:03:20.00 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 205.278
[silencedetect @ 0x7feb4b40d9e0] silence_end: 205.806 | silence_duration: 0.527937
frame= 5167 fps=332 q=0.0 size=N/A time=00:03:27.28 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 206.216
[silencedetect @ 0x7feb4b40d9e0] silence_end: 206.659 | silence_duration: 0.442667
frame= 5339 fps=332 q=0.0 size=N/A time=00:03:34.16 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 215.789
[silencedetect @ 0x7feb4b40d9e0] silence_end: 216.274 | silence_duration: 0.485271
frame= 5539 fps=334 q=0.0 size=N/A time=00:03:42.16 bitrate=N/A
frame= 5708 fps=334 q=0.0 size=N/A time=00:03:48.92 bitrate=N/A
frame= 5870 fps=334 q=0.0 size=N/A time=00:03:55.40 bitrate=N/A
frame= 6051 fps=334 q=0.0 size=N/A time=00:04:02.64 bitrate=N/A
[null @ 0x7feb4b810600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 11837448 >= 11837448
[silencedetect @ 0x7feb4b40d9e0] silence_start: 246.309
[silencedetect @ 0x7feb4b40d9e0] silence_end: 246.742 | silence_duration: 0.432
frame= 6232 fps=335 q=0.0 size=N/A time=00:04:09.88 bitrate=N/A
frame= 6385 fps=334 q=0.0 size=N/A time=00:04:16.00 bitrate=N/A
frame= 6540 fps=334 q=0.0 size=N/A time=00:04:22.20 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 266.596
[silencedetect @ 0x7feb4b40d9e0] silence_end: 267.209 | silence_duration: 0.613229
frame= 6740 fps=335 q=0.0 size=N/A time=00:04:30.20 bitrate=N/A
frame= 6908 fps=335 q=0.0 size=N/A time=00:04:36.92 bitrate=N/A
frame= 7082 fps=336 q=0.0 size=N/A time=00:04:43.88 bitrate=N/A
frame= 7243 fps=335 q=0.0 size=N/A time=00:04:50.32 bitrate=N/A
frame= 7431 fps=336 q=0.0 size=N/A time=00:04:57.84 bitrate=N/A
[null @ 0x7feb4b810600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 14273127 >= 14273127
[silencedetect @ 0x7feb4b40d9e0] silence_start: 297.191
[silencedetect @ 0x7feb4b40d9e0] silence_end: 297.677 | silence_duration: 0.485292
frame= 7600 fps=336 q=0.0 size=N/A time=00:05:04.60 bitrate=N/A
frame= 7775 fps=336 q=0.0 size=N/A time=00:05:11.60 bitrate=N/A
[null @ 0x7feb4b810600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 15255582 >= 15255582
[silencedetect @ 0x7feb4b40d9e0] silence_start: 317.553
[silencedetect @ 0x7feb4b40d9e0] silence_end: 318.144 | silence_duration: 0.591896
frame= 7980 fps=338 q=0.0 size=N/A time=00:05:19.80 bitrate=N/A
frame= 8135 fps=338 q=0.0 Lsize=N/A time=00:05:26.08 bitrate=N/A
video:763kB audio:61036kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
다음 grep 명령을 사용했습니다 ...
grep silencedetect silence.txt > extract.txt
...이 "extract.txt"파일을 얻으려면 :
[silencedetect @ 0x7feb4b40d9e0] silence_start: 15.056
[silencedetect @ 0x7feb4b40d9e0] silence_end: 15.6482 | silence_duration: 0.592229
[silencedetect @ 0x7feb4b40d9e0] silence_start: 30.5347
[silencedetect @ 0x7feb4b40d9e0] silence_end: 31.0626 | silence_duration: 0.527958
frame= 839 fps=333 q=0.0 size=N/A time=00:00:34.08 bitrate=N/A
frame= 975 fps=322 q=0.0 size=N/A time=00:00:39.52 bitrate=N/A
frame= 1150 fps=325 q=0.0 size=N/A time=00:00:46.52 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 54.051
[silencedetect @ 0x7feb4b40d9e0] silence_end: 54.5362 | silence_duration: 0.485292
[silencedetect @ 0x7feb4b40d9e0] silence_start: 84.4542
[silencedetect @ 0x7feb4b40d9e0] silence_end: 85.4725 | silence_duration: 1.01831
frame= 2150 fps=329 q=0.0 size=N/A time=00:01:26.52 bitrate=N/A
frame= 2289 fps=325 q=0.0 size=N/A time=00:01:32.08 bitrate=N/A
frame= 2460 fps=326 q=0.0 size=N/A time=00:01:38.92 bitrate=N/A
frame= 2584 fps=321 q=0.0 size=N/A time=00:01:43.88 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 104.986
[silencedetect @ 0x7feb4b40d9e0] silence_end: 105.482 | silence_duration: 0.495979
frame= 2763 fps=323 q=0.0 size=N/A time=00:01:51.04 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 115.327
[silencedetect @ 0x7feb4b40d9e0] silence_end: 115.983 | silence_duration: 0.656042
frame= 2939 fps=324 q=0.0 size=N/A time=00:01:58.08 bitrate=N/A
frame= 3101 fps=324 q=0.0 size=N/A time=00:02:04.56 bitrate=N/A
frame= 3264 fps=324 q=0.0 size=N/A time=00:02:11.08 bitrate=N/A
frame= 3474 fps=329 q=0.0 size=N/A time=00:02:19.48 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 138.695
[silencedetect @ 0x7feb4b40d9e0] silence_end: 139.415 | silence_duration: 0.719875
[silencedetect @ 0x7feb4b40d9e0] silence_start: 149.206
[silencedetect @ 0x7feb4b40d9e0] silence_end: 149.883 | silence_duration: 0.677187
frame= 3811 fps=329 q=0.0 size=N/A time=00:02:32.96 bitrate=N/A
frame= 3968 fps=329 q=0.0 size=N/A time=00:02:39.24 bitrate=N/A
frame= 4132 fps=329 q=0.0 size=N/A time=00:02:45.80 bitrate=N/A
frame= 4296 fps=329 q=0.0 size=N/A time=00:02:52.36 bitrate=N/A
frame= 4492 fps=331 q=0.0 size=N/A time=00:03:00.28 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 179.842
[silencedetect @ 0x7feb4b40d9e0] silence_end: 180.44 | silence_duration: 0.597313
frame= 4655 fps=331 q=0.0 size=N/A time=00:03:06.80 bitrate=N/A
frame= 4821 fps=331 q=0.0 size=N/A time=00:03:13.44 bitrate=N/A
frame= 4985 fps=330 q=0.0 size=N/A time=00:03:20.00 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 205.278
[silencedetect @ 0x7feb4b40d9e0] silence_end: 205.806 | silence_duration: 0.527937
frame= 5167 fps=332 q=0.0 size=N/A time=00:03:27.28 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 206.216
[silencedetect @ 0x7feb4b40d9e0] silence_end: 206.659 | silence_duration: 0.442667
frame= 5339 fps=332 q=0.0 size=N/A time=00:03:34.16 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 215.789
[silencedetect @ 0x7feb4b40d9e0] silence_end: 216.274 | silence_duration: 0.485271
[silencedetect @ 0x7feb4b40d9e0] silence_start: 246.309
[silencedetect @ 0x7feb4b40d9e0] silence_end: 246.742 | silence_duration: 0.432
frame= 6232 fps=335 q=0.0 size=N/A time=00:04:09.88 bitrate=N/A
frame= 6385 fps=334 q=0.0 size=N/A time=00:04:16.00 bitrate=N/A
frame= 6540 fps=334 q=0.0 size=N/A time=00:04:22.20 bitrate=N/A
[silencedetect @ 0x7feb4b40d9e0] silence_start: 266.596
[silencedetect @ 0x7feb4b40d9e0] silence_end: 267.209 | silence_duration: 0.613229
[silencedetect @ 0x7feb4b40d9e0] silence_start: 297.191
[silencedetect @ 0x7feb4b40d9e0] silence_end: 297.677 | silence_duration: 0.485292
[silencedetect @ 0x7feb4b40d9e0] silence_start: 317.553
[silencedetect @ 0x7feb4b40d9e0] silence_end: 318.144 | silence_duration: 0.591896
문제는 그것이 내가 예를 들어 "frame = 4655 fps = 331 q = 0.0 size = N / A time = 00 : 03 : 06.80 bitrate = N / A"등과 같이 묻는 라인 이상을 제공한다는 것입니다.
그래서 내 질문에 grep 명령을 사용하여 원하는 줄을 얻는 방법은 무엇입니까? 다음으로, 좀 더 나를 도울 수 있다면, 각 silence_start 및 silence_end 값을 가져 와서 ffmpeg로 다른 명령을 시작하고 비디오를 여러 세그먼트로 나누는 것이 좋습니다.