我正在尝试将在线输入流从m3u8播放列表保存到Mp4文件。
这是我的命令:
usr/bin/ffmpeg -y -i '.$stream.' -t 20 \
-vcodec copy -s 640x480 \
-acodec copy -bsf:a aac_adtstoasc \
-f mp4 '.$filename.'.mp4 > block.txt 2>&1 &
这是我的输出文件:
ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
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, hls,applehttp, from 'playlist.m3u8':
Duration: N/A, start: 2375.973000, bitrate: N/A
Program 0
Metadata:
variant_bitrate : 613420
Stream #0:0: Data: timed_id3 (ID3 / 0x20334449)
Metadata:
variant_bitrate : 613420
Stream #0:1: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv), 640x480 [SAR 1:1 DAR 4:3], 30 fps, 30 tbr, 90k tbn, 60 tbc
Metadata:
variant_bitrate : 613420
Stream #0:2: Audio: aac (LC) ([15][0][0][0] / 0x000F), 16000 Hz, mono, fltp, 53 kb/s
Metadata:
variant_bitrate : 613420
Output #0, mp4, to 'output.mp4':
Metadata:
encoder : Lavf56.25.101
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 30 fps, 30 tbr, 90k tbn, 90k tbc
Metadata:
variant_bitrate : 613420
Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 16000 Hz, mono, 53 kb/s
Metadata:
variant_bitrate : 613420
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Stream #0:2 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x18e7700] Non-monotonous DTS in output stream 0:0; previous: 168300, current: 168300; changing to 168301. This may result in incorrect timestamps in the output file.
frame= 53 fps=0.0 q=-1.0 size= 163kB time=00:00:02.75 bitrate= 485.9kbits/s
frame= 79 fps= 74 q=-1.0 size= 294kB time=00:00:04.28 bitrate= 560.7kbits/s
[mp4 @ 0x18e7700] Non-monotonous DTS in output stream 0:0; previous: 400320, current: 400320; changing to 400321. This may result in incorrect timestamps in the output file.
[mp4 @ 0x18e7700] Non-monotonous DTS in output stream 0:0; previous: 416970, current: 416970; changing to 416971. This may result in incorrect timestamps in the output file.
frame= 131 fps= 81 q=-1.0 size= 466kB time=00:00:07.10 bitrate= 537.4kbits/s
frame= 150 fps= 67 q=-1.0 size= 506kB time=00:00:08.12 bitrate= 510.2kbits/s
frame= 163 fps= 59 q=-1.0 size= 549kB time=00:00:08.89 bitrate= 505.4kbits/s
frame= 177 fps= 54 q=-1.0 size= 621kB time=00:00:09.79 bitrate= 519.4kbits/s
[mp4 @ 0x18e7700] Non-monotonous DTS in output stream 0:0; previous: 902160, current: 902160; changing to 902161. This may result in incorrect timestamps in the output file.
frame= 206 fps= 54 q=-1.0 size= 732kB time=00:00:11.52 bitrate= 520.8kbits/s
frame= 236 fps= 55 q=-1.0 size= 869kB time=00:00:13.44 bitrate= 529.7kbits/s
frame= 276 fps= 57 q=-1.0 size= 1036kB time=00:00:15.74 bitrate= 539.0kbits/s
[mp4 @ 0x18e7700] Non-monotonous DTS in output stream 0:0; previous: 1433880, current: 1433880; changing to 1433881. This may result in incorrect timestamps in the output file.
frame= 284 fps= 36 q=-1.0 size= 1079kB time=00:00:16.25 bitrate= 543.7kbits/s
[mp4 @ 0x18e7700] Non-monotonous DTS in output stream 0:0; previous: 1454490, current: 1454490; changing to 1454491. This may result in incorrect timestamps in the output file.
frame= 295 fps= 35 q=-1.0 size= 1129kB time=00:00:16.70 bitrate= 553.9kbits/s
frame= 317 fps= 35 q=-1.0 size= 1222kB time=00:00:18.04 bitrate= 554.8kbits/s
[mp4 @ 0x18e7700] Non-monotonous DTS in output stream 0:0; previous: 1696050, current: 1696050; changing to 1696051. This may result in incorrect timestamps in the output file.
frame= 347 fps= 36 q=-1.0 size= 1342kB time=00:00:19.39 bitrate= 566.9kbits/s
frame= 361 fps= 37 q=-1.0 Lsize= 1400kB time=00:00:20.03 bitrate= 572.5kbits/s
video:1274kB audio:115kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.784608%
正如您所看到的,在录制期间似乎有一些丢帧,我不知道如何纠正这一点,以便最后有一个干净的文件。
我认为这可能是个问题?但我无法确切地指出什么是错的。 我试着玩缓冲区&帧速率但没有任何改变。
任何帮助都将不胜感激。