ffmpeg:如何将 H.265 编码流发送到 wowza?
ffmpeg : How can I send a H.265 encoded stream to wowza?
我设法将 H.265 编码为这样的输出文件:
ffmpeg -i test.m2ts -c:v libx265 -c:a copy output.mp4
我设法像这样将 H.264 文件流式传输到 wowza :
ffmpeg -re -i sample.mp4 -vcodec libx264 -vprofile default -vprofile baseline -r 24 -g 48 -vb 150000 -strict experimental -acodec aac -ab 96000 -ar 48000 -ac 2 -f rtsp -muxdelay 0.1 rtsp://username:password@127.0.0.1:1935/ApplicationName/myStream
但我似乎无法将 H.265 流式传输到 rtsp 流。
如果我在上面的命令中使用 libx265,我会得到错误:
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
如有任何提示,我们将不胜感激。
这是带有 -loglevel verbose 的控制台消息
>ffmpeg -re -i sample.mp4 -vcodec libx265 -vprofile default -vprofile baseline -r 24 -g 48 -vb 150000 -strict experimental -acodec aac -ab 96000 -ar 48000 -ac 2 -f rtsp -muxdelay 0.1 rtsp://username:password@127.0.0.1:1935/ApplicationName/myStream -l
oglevel verbose
ffmpeg version N-69156-gff5b9a1c Copyright (c) 2000-2015 the FFmpeg developers
built on Jan 20 2015 00:38:00 with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-
libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --
enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil 54. 17.100 / 54. 17.100
libavcodec 56. 20.100 / 56. 20.100
libavformat 56. 19.100 / 56. 19.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 8.100 / 5. 8.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Routing option strict to both codec and muxer layer
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample.mp4':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
creation_time : 1970-01-01 00:00:00
encoder : Lavf52.73.0
Duration: 00:09:56.46, start: 0.000000, bitrate: 524 kb/s
Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 424x240 (432x240), 420 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : DataHandler
encoder : libx264
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 99 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : DataHandler
[graph 0 input from stream 0:0 @ 00000000050f6e60] w:424 h:240 pixfmt:yuv420p tb:1/24 fr:24/1 sar:0/1 sws_param:flags=2
[graph 1 input from stream 0:1 @ 0000000002c38700] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
[libx265 @ 0000000002c172a0] [Eval @ 000000000022aca0] Undefined constant or missing '(' in 'baseline'
[libx265 @ 0000000002c172a0] Unable to parse option value "baseline"
[libx265 @ 0000000002c172a0] Error setting option profile to value baseline.
Output #0, rtsp, to 'rtsp://username:password@127.0.0.1:1935/ApplicationName/myStream':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf52.73.0
Stream #0:0(eng): Video: hevc, none, q=2-31, 128 kb/s, 24 fps (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : DataHandler
encoder : Lavc56.20.100 libx265
Stream #0:1(eng): Audio: aac, 0 channels, 128 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : DataHandler
encoder : Lavc56.20.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
根据稍微隐藏的输出行
,libx265 似乎没有"profile baseline" 选项
Error setting option profile to value baseline.
我设法将 H.265 编码为这样的输出文件:
ffmpeg -i test.m2ts -c:v libx265 -c:a copy output.mp4
我设法像这样将 H.264 文件流式传输到 wowza :
ffmpeg -re -i sample.mp4 -vcodec libx264 -vprofile default -vprofile baseline -r 24 -g 48 -vb 150000 -strict experimental -acodec aac -ab 96000 -ar 48000 -ac 2 -f rtsp -muxdelay 0.1 rtsp://username:password@127.0.0.1:1935/ApplicationName/myStream
但我似乎无法将 H.265 流式传输到 rtsp 流。
如果我在上面的命令中使用 libx265,我会得到错误:
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
如有任何提示,我们将不胜感激。
这是带有 -loglevel verbose 的控制台消息
>ffmpeg -re -i sample.mp4 -vcodec libx265 -vprofile default -vprofile baseline -r 24 -g 48 -vb 150000 -strict experimental -acodec aac -ab 96000 -ar 48000 -ac 2 -f rtsp -muxdelay 0.1 rtsp://username:password@127.0.0.1:1935/ApplicationName/myStream -l
oglevel verbose
ffmpeg version N-69156-gff5b9a1c Copyright (c) 2000-2015 the FFmpeg developers
built on Jan 20 2015 00:38:00 with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-
libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --
enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil 54. 17.100 / 54. 17.100
libavcodec 56. 20.100 / 56. 20.100
libavformat 56. 19.100 / 56. 19.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 8.100 / 5. 8.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Routing option strict to both codec and muxer layer
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample.mp4':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
creation_time : 1970-01-01 00:00:00
encoder : Lavf52.73.0
Duration: 00:09:56.46, start: 0.000000, bitrate: 524 kb/s
Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 424x240 (432x240), 420 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : DataHandler
encoder : libx264
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 99 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : DataHandler
[graph 0 input from stream 0:0 @ 00000000050f6e60] w:424 h:240 pixfmt:yuv420p tb:1/24 fr:24/1 sar:0/1 sws_param:flags=2
[graph 1 input from stream 0:1 @ 0000000002c38700] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
[libx265 @ 0000000002c172a0] [Eval @ 000000000022aca0] Undefined constant or missing '(' in 'baseline'
[libx265 @ 0000000002c172a0] Unable to parse option value "baseline"
[libx265 @ 0000000002c172a0] Error setting option profile to value baseline.
Output #0, rtsp, to 'rtsp://username:password@127.0.0.1:1935/ApplicationName/myStream':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf52.73.0
Stream #0:0(eng): Video: hevc, none, q=2-31, 128 kb/s, 24 fps (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : DataHandler
encoder : Lavc56.20.100 libx265
Stream #0:1(eng): Audio: aac, 0 channels, 128 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : DataHandler
encoder : Lavc56.20.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
根据稍微隐藏的输出行
,libx265 似乎没有"profile baseline" 选项Error setting option profile to value baseline.