Я записываю аудио / видео на своем веб-сайте с помощью приложения Flash через Red5 Server, и сгенерированный вывод содержит дополнительные 30 секунд замораживаемых фрагментов.

Я проверил видео через ffmpeg и обнаружил, что первые 30 секунд получают 0 кБ. Есть ли способ удалить части 0 кБ из записанного видео?

ffmpeg -i vid3.flv -qscale 0 -async 1 -ar 22050 -vcodec libx264 vid3.mp4

ffmpeg version N-56663-g851a6e2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep 25 2013 18:02:05 with gcc 4.8.1 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 46.100 / 52. 46.100
  libavcodec     55. 33.100 / 55. 33.100
  libavformat    55. 18.102 / 55. 18.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 87.100 /  3. 87.100
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
[flv @ 026b99e0] Stream discovered after head already parsed
Input #0, flv, from 'vid3.flv':
  Metadata:
    canSeekToEnd    : false
    createdby       : AMS 5
    creationdate    : Thu Dec 05 16:58:09 2013
  Duration: 00:00:15.92, start: 0.000000, bitrate: 1151 kb/s
    Stream #0:0: Video: flv1, yuv420p, 600x338, 1k tbr, 1k tbn, 1k tbc
    Stream #0:1: Audio: nellymoser, 11025 Hz, mono, flt
    Stream #0:2: Data: none
Please use -q:a or -q:v, -qscale is ambiguous
File 'vid3.mp4' already exists. Overwrite ? [y/N] y
-async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.
100000:first_pts=0.
[libx264 @ 03b0fbc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 03b0fbc0] profile High, level 5.1
[libx264 @ 03b0fbc0] 264 - core 135 r2345 f0c1c53 - H.264/MPEG-4 AVC codec - Cop
yleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
ma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i
nterlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenec
ut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=
0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'vid3.mp4':
  Metadata:
    canSeekToEnd    : false
    createdby       : AMS 5
    creationdate    : Thu Dec 05 16:58:09 2013
    encoder         : Lavf55.18.102
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 600x33
8, q=-1--1, 16k tbn, 1k tbc
    Stream #0:1: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 22050 Hz, m
ono, s16, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (flv -> libx264)
  Stream #0:1 -> #0:1 (nellymoser -> libvo_aacenc)
Press [q] to stop, [?] for help

Вот дополнительные разделы:

frame=  191 fps=0.0 q=33.0 size=       0kB time=00:00:00.13 bitrate=   2.8kbits/
frame=  288 fps=221 q=33.0 size=       0kB time=00:00:00.23 bitrate=   1.6kbits/
frame=  416 fps=206 q=33.0 size=       0kB time=00:00:00.36 bitrate=   1.1kbits/
frame=  528 fps=195 q=33.0 size=       0kB time=00:00:00.47 bitrate=   0.8kbits/
frame=  667 fps=201 q=33.0 size=       0kB time=00:00:00.61 bitrate=   0.6kbits/
frame=  780 fps=193 q=33.0 size=       0kB time=00:00:00.72 bitrate=   0.5kbits/
frame=  899 fps=194 q=33.0 size=       0kB time=00:00:00.84 bitrate=   0.5kbits/
frame= 1011 fps=189 q=33.0 size=       0kB time=00:00:00.95 bitrate=   0.4kbits/
frame= 1139 fps=190 q=33.0 size=       0kB time=00:00:01.08 bitrate=   0.4kbits/
frame= 1249 fps=188 q=33.0 size=       0kB time=00:00:01.19 bitrate=   0.3kbits/
frame= 1376 fps=190 q=33.0 size=       0kB time=00:00:01.32 bitrate=   0.3kbits/
frame= 1493 fps=187 q=33.0 size=       0kB time=00:00:01.44 bitrate=   0.3kbits/
frame= 1616 fps=187 q=33.0 size=       0kB time=00:00:01.56 bitrate=   0.2kbits/
frame= 1728 fps=186 q=33.0 size=       0kB time=00:00:01.67 bitrate=   0.2kbits/

Это продолжается позже с:

frame= 3432 fps=349 q=33.0 size=       1kB time=00:00:03.38 bitrate=   3.6kbits/
frame= 3432 fps=205 q=33.0 size=      17kB time=00:00:03.38 bitrate=  40.9kbits/
frame= 3559 fps=205 q=33.0 size=      56kB time=00:00:03.50 bitrate= 131.2kbits/
frame= 3645 fps=204 q=33.0 size=      77kB time=00:00:03.59 bitrate= 175.2kbits/
frame= 3801 fps=205 q=33.0 size=     113kB time=00:00:03.74 bitrate= 247.8kbits/
frame= 3886 fps=202 q=33.0 size=     159kB time=00:00:03.83 bitrate= 340.1kbits/
frame= 4043 fps=204 q=33.0 size=     203kB time=00:00:03.99 bitrate= 416.6kbits/
frame= 4132 fps=201 q=33.0 size=     267kB time=00:00:04.08 bitrate= 536.3kbits/
frame= 4241 fps=201 q=33.0 size=     321kB time=00:00:04.18 bitrate= 627.4kbits/
frame= 4401 fps=201 q=33.0 size=     342kB time=00:00:04.34 bitrate= 644.4kbits/
frame= 4486 fps=200 q=33.0 size=     365kB time=00:00:04.43 bitrate= 673.7kbits/
frame= 4611 fps=200 q=33.0 size=     385kB time=00:00:04.55 bitrate= 692.6kbits/
frame= 4774 fps=201 q=33.0 size=     404kB time=00:00:04.72 bitrate= 701.7kbits/
frame= 4845 fps=199 q=33.0 size=     427kB time=00:00:04.79 bitrate= 729.9kbits/
frame= 4970 fps=199 q=33.0 size=     444kB time=00:00:04.91 bitrate= 740.1kbits/
frame= 5079 fps=199 q=33.0 size=     509kB time=00:00:05.02 bitrate= 829.6kbits/
frame= 5215 fps=199 q=33.0 size=     580kB time=00:00:05.16 bitrate= 920.8kbits/
frame= 5323 fps=198 q=33.0 size=     610kB time=00:00:05.27 bitrate= 948.7kbits/
frame= 5448 fps=198 q=33.0 size=     677kB time=00:00:05.39 bitrate=1027.5kbits/
frame= 5569 fps=199 q=33.0 size=     687kB time=00:00:05.51 bitrate=1020.6kbits/
frame= 5643 fps=198 q=33.0 size=     745kB time=00:00:05.59 bitrate=1091.6kbits/
frame= 5779 fps=197 q=33.0 size=     809kB time=00:00:05.72 bitrate=1157.5kbits/
frame= 5888 fps=198 q=33.0 size=     850kB time=00:00:05.83 bitrate=1192.7kbits/
frame= 6006 fps=198 q=33.0 size=     902kB time=00:00:05.95 bitrate=1240.4kbits/
frame= 6124 fps=198 q=33.0 size=     934kB time=00:00:06.07 bitrate=1260.0kbits/
frame= 6249 fps=197 q=33.0 size=     951kB time=00:00:06.19 bitrate=1256.5kbits/
frame= 6341 fps=197 q=33.0 size=     962kB time=00:00:06.28 bitrate=1253.5kbits/
frame= 6454 fps=197 q=33.0 size=     985kB time=00:00:06.40 bitrate=1260.9kbits/
frame= 6581 fps=197 q=33.0 size=    1008kB time=00:00:06.52 bitrate=1265.1kbits/
frame= 6690 fps=197 q=33.0 size=    1041kB time=00:00:06.66 bitrate=1280.0kbits/
frame= 6817 fps=196 q=33.0 size=    1055kB time=00:00:06.76 bitrate=1277.3kbits/
frame= 6926 fps=196 q=33.0 size=    1084kB time=00:00:06.89 bitrate=1287.6kbits/
frame= 7063 fps=196 q=33.0 size=    1105kB time=00:00:07.03 bitrate=1286.8kbits/
frame= 7175 fps=196 q=33.0 size=    1130kB time=00:00:07.12 bitrate=1299.4kbits/
frame= 7262 fps=196 q=33.0 size=    1144kB time=00:00:07.21 bitrate=1298.5kbits/
frame= 7372 fps=196 q=33.0 size=    1169kB time=00:00:07.32 bitrate=1307.7kbits/
frame= 7498 fps=195 q=33.0 size=    1189kB time=00:00:07.45 bitrate=1307.1kbits/
frame= 7620 fps=195 q=33.0 size=    1219kB time=00:00:07.59 bitrate=1315.3kbits/
frame= 7745 fps=195 q=33.0 size=    1229kB time=00:00:07.69 bitrate=1309.2kbits/
frame= 7857 fps=195 q=33.0 size=    1260kB time=00:00:07.82 bitrate=1319.6kbits/
frame= 7979 fps=195 q=33.0 size=    1273kB time=00:00:07.92 bitrate=1315.1kbits/
frame= 8068 fps=195 q=33.0 size=    1287kB time=00:00:08.01 bitrate=1314.9kbits/
frame= 8217 fps=195 q=33.0 size=    1324kB time=00:00:08.16 bitrate=1328.3kbits/
frame= 8335 fps=195 q=33.0 size=    1349kB time=00:00:08.28 bitrate=1333.2kbits/
frame= 8493 fps=195 q=33.0 size=    1374kB time=00:00:08.44 bitrate=1333.7kbits/
frame= 8546 fps=194 q=33.0 size=    1388kB time=00:00:08.49 bitrate=1338.4kbits/
frame= 8703 fps=194 q=33.0 size=    1427kB time=00:00:08.65 bitrate=1350.3kbits/
frame= 8821 fps=193 q=33.0 size=    1444kB time=00:00:08.76 bitrate=1349.0kbits/
frame= 8972 fps=193 q=33.0 size=    1481kB time=00:00:08.93 bitrate=1357.3kbits/
frame= 9130 fps=193 q=33.0 size=    1496kB time=00:00:09.07 bitrate=1349.8kbits/
frame= 9268 fps=192 q=33.0 size=    1523kB time=00:00:09.21 bitrate=1353.9kbits/
frame= 9373 fps=192 q=33.0 size=    1536kB time=00:00:09.32 bitrate=1350.0kbits/
frame= 9423 fps=176 q=33.0 size=    1536kB time=00:00:09.37 bitrate=1342.8kbits/
frame= 9457 fps=175 q=33.0 size=    1553kB time=00:00:09.40 bitrate=1352.3kbits/
frame= 9583 fps=175 q=33.0 size=    1586kB time=00:00:09.54 bitrate=1361.6kbits/
frame= 9752 fps=176 q=33.0 size=    1605kB time=00:00:09.70 bitrate=1355.4kbits/
frame= 9824 fps=175 q=33.0 size=    1627kB time=00:00:09.77 bitrate=1363.7kbits/
frame= 9981 fps=175 q=33.0 size=    1663kB time=00:00:09.92 bitrate=1371.7kbits/
frame=10142 fps=175 q=33.0 size=    1691kB time=00:00:10.09 bitrate=1372.0kbits/
frame=10228 fps=175 q=33.0 size=    1712kB time=00:00:10.19 bitrate=1376.4kbits/
frame=10385 fps=176 q=33.0 size=    1726kB time=00:00:10.33 bitrate=1368.6kbits/
frame=10517 fps=176 q=33.0 size=    1752kB time=00:00:10.46 bitrate=1370.8kbits/
frame=10517 fps=155 q=33.0 size=    1761kB time=00:00:10.51 bitrate=1371.9kbits/
frame=10631 fps=154 q=33.0 size=    1771kB time=00:00:10.57 bitrate=1371.3kbits/
frame=10696 fps=154 q=33.0 size=    1787kB time=00:00:10.65 bitrate=1373.6kbits/
frame=10781 fps=153 q=33.0 size=    1808kB time=00:00:10.74 bitrate=1378.3kbits/
frame=10869 fps=153 q=33.0 size=    1811kB time=00:00:10.81 bitrate=1371.6kbits/
frame=10938 fps=153 q=33.0 size=    1840kB time=00:00:10.88 bitrate=1384.2kbits/
frame=11025 fps=152 q=33.0 size=    1855kB time=00:00:10.98 bitrate=1384.3kbits/
frame=11110 fps=152 q=33.0 size=    1875kB time=00:00:11.07 bitrate=1387.0kbits/
frame=11224 fps=152 q=33.0 size=    1901kB time=00:00:11.17 bitrate=1393.9kbits/
frame=11313 fps=153 q=33.0 size=    1914kB time=00:00:11.26 bitrate=1392.0kbits/
frame=11398 fps=153 q=33.0 size=    1941kB time=00:00:11.35 bitrate=1400.6kbits/
frame=11495 fps=153 q=33.0 size=    1958kB time=00:00:11.44 bitrate=1401.6kbits/
frame=11582 fps=153 q=33.0 size=    1975kB time=00:00:11.53 bitrate=1402.5kbits/
frame=11670 fps=153 q=33.0 size=    2003kB time=00:00:11.63 bitrate=1410.8kbits/
frame=11868 fps=153 q=33.0 size=    2039kB time=00:00:11.81 bitrate=1413.9kbits/
frame=12063 fps=154 q=33.0 size=    2070kB time=00:00:12.01 bitrate=1411.8kbits/
frame=12115 fps=154 q=33.0 size=    2082kB time=00:00:12.06 bitrate=1413.7kbits/
frame=12240 fps=154 q=33.0 size=    2118kB time=00:00:12.18 bitrate=1423.4kbits/
frame=12326 fps=154 q=33.0 size=    2133kB time=00:00:12.28 bitrate=1423.1kbits/
frame=12431 fps=154 q=33.0 size=    2165kB time=00:00:12.37 bitrate=1432.7kbits/
frame=12592 fps=154 q=33.0 size=    2195kB time=00:00:12.55 bitrate=1432.1kbits/
frame=12748 fps=155 q=33.0 size=    2221kB time=00:00:12.69 bitrate=1432.9kbits/
frame=12846 fps=155 q=30.0 size=    2238kB time=00:00:12.79 bitrate=1433.1kbits/
frame=12995 fps=155 q=33.0 size=    2255kB time=00:00:12.94 bitrate=1427.5kbits/
frame=13062 fps=155 q=33.0 size=    2280kB time=00:00:13.02 bitrate=1434.1kbits/
frame=13201 fps=155 q=33.0 size=    2309kB time=00:00:13.16 bitrate=1436.8kbits/
frame=13361 fps=156 q=33.0 size=    2323kB time=00:00:13.30 bitrate=1430.1kbits/
frame=13466 fps=156 q=33.0 size=    2348kB time=00:00:13.41 bitrate=1434.2kbits/
frame=13552 fps=156 q=33.0 size=    2361kB time=00:00:13.50 bitrate=1432.4kbits/
frame=13637 fps=156 q=33.0 size=    2375kB time=00:00:13.58 bitrate=1432.0kbits/
frame=13793 fps=157 q=33.0 size=    2401kB time=00:00:13.74 bitrate=1431.6kbits/
frame=13878 fps=157 q=33.0 size=    2417kB time=00:00:13.82 bitrate=1431.9kbits/
frame=13954 fps=157 q=33.0 size=    2448kB time=00:00:13.90 bitrate=1441.9kbits/
frame=14110 fps=157 q=33.0 size=    2464kB time=00:00:14.05 bitrate=1435.6kbits/
frame=14187 fps=157 q=33.0 size=    2494kB time=00:00:14.13 bitrate=1444.9kbits/
frame=14352 fps=158 q=33.0 size=    2506kB time=00:00:14.30 bitrate=1435.6kbits/
frame=14426 fps=157 q=33.0 size=    2540kB time=00:00:14.37 bitrate=1447.5kbits/
frame=14530 fps=158 q=33.0 size=    2550kB time=00:00:14.47 bitrate=1442.9kbits/
frame=14647 fps=158 q=33.0 size=    2580kB time=00:00:14.60 bitrate=1447.2kbits/
frame=14803 fps=158 q=33.0 size=    2595kB time=00:00:14.75 bitrate=1441.3kbits/
frame=14887 fps=158 q=33.0 size=    2608kB time=00:00:14.83 bitrate=1440.2kbits/
frame=15035 fps=158 q=33.0 size=    2637kB time=00:00:14.98 bitrate=1442.0kbits/
frame=15121 fps=158 q=33.0 size=    2656kB time=00:00:15.06 bitrate=1443.9kbits/
frame=15275 fps=159 q=33.0 size=    2680kB time=00:00:15.22 bitrate=1442.0kbits/
frame=15362 fps=159 q=33.0 size=    2694kB time=00:00:15.31 bitrate=1441.3kbits/
frame=15488 fps=159 q=33.0 size=    2722kB time=00:00:15.43 bitrate=1444.4kbits/
frame=15519 fps=159 q=-1.0 Lsize=    2926kB time=00:00:15.57 bitrate=1538.5kbits
/s dup=15201 drop=0
video:2491kB audio:245kB subtitle:0 global headers:0kB muxing overhead 6.957093%

[libx264 @ 03b0fbc0] frame I:64    Avg QP:17.98  size: 11359
[libx264 @ 03b0fbc0] frame P:3947  Avg QP:19.98  size:   350
[libx264 @ 03b0fbc0] frame B:11508 Avg QP:26.88  size:    38
[libx264 @ 03b0fbc0] consecutive B-frames:  1.1%  0.1%  0.1% 98.7%
[libx264 @ 03b0fbc0] mb I  I16..4: 24.0% 74.3%  1.8%
[libx264 @ 03b0fbc0] mb P  I16..4:  0.3%  2.0%  0.0%  P16..4:  2.4%  0.8%  0.6%
 0.0%  0.0%    skip:93.9%
[libx264 @ 03b0fbc0] mb B  I16..4:  0.0%  0.1%  0.0%  B16..8:  2.3%  0.0%  0.0%
 direct: 0.0%  skip:97.6%  L0:57.2% L1:42.7% BI: 0.1%
[libx264 @ 03b0fbc0] 8x8 transform intra:80.7% inter:70.2%
[libx264 @ 03b0fbc0] coded y,uvDC,uvAC intra: 57.7% 71.6% 20.3% inter: 0.3% 0.6%
 0.1%
[libx264 @ 03b0fbc0] i16 v,h,dc,p: 43% 28% 23%  5%
[libx264 @ 03b0fbc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 24% 42%  3%  1%  1%  1%
 3%  3%
[libx264 @ 03b0fbc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 46% 26%  9%  3%  3%  3%  3%
 4%  3%
[libx264 @ 03b0fbc0] i8c dc,h,v,p: 38% 30% 26%  6%
[libx264 @ 03b0fbc0] Weighted P-Frames: Y:0.1% UV:0.1%
[libx264 @ 03b0fbc0] ref P L0: 81.3% 12.1%  5.1%  1.5%  0.0%
[libx264 @ 03b0fbc0] ref B L0: 54.7% 42.1%  3.2%
[libx264 @ 03b0fbc0] ref B L1: 93.7%  6.3%
[libx264 @ 03b0fbc0] kb/s:1314.44

D:\ffmpeg\bin>

Я знаю, что это не проблема с ffmpeg, это проблема с моим приложением Flash или сервером Red5/AMS. Но я думаю, что смогу избавиться от этой проблемы, если смогу удалить эти части по 0 кБ из моего видео.

1 ответ1

0

Red5 записывает только то, что получено от клиента; сервер не создает "лишних", включающих в себя тихие аудиоданные. Исходя из того, что я знаю о сервере, я предполагаю, что ваш клиент публикации отправляет больше данных после того, как вы считаете, что он остановился.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .