video - VLC 2.2 and Levels -
i have application i've written provide simulated mp4 camera streams "black box". use irony quotes because don't have access sources, have support contract vendor makes it.
this black box supports h.264 level 2.2. not use sdp, expects camera streams 640x480 @ 30hz. understand reasonably standard output surveillance cameras.
so application using vlc (libvlc specific) stream mp4 files device. have working fine (with one minor exception, that's separate issue). however, vlc 2.1.5. when tried upgrading latest 2.2.1, instead of videos on other side of our black box seeing whiteish-gray squares.
our vendor looked on wireshark dumps, , told me vlc 2.2.1 stream reporting level 5.1 instead of 2.2, , using high profile instead of baseline or main. looks vlc trying "upgrade" (transcode?) video on me, , that's messing reader on black box.
is there way old behavior vlc 2.1.5 back, or force use level , profile of choosing?
h.264 profiles
profiles sets of capabilities. if black box supports baseline
profile it'll not able decode stream using high
capabilities.
in vlc
can set h.264 profile used x264
encoder this:
--sout="#transcode{vcodec=h264,venc=x264{profile=baseline}...
h.264 levels
think of levels constraint/indicator of required decoder performance. if decoder supports level profile must able decode streams @ level , of lower levels.
first of all, level 640x480 @ 30 fps 3
, not 2.2
.
you can calculate following:
macrobolocks = ceil(640/16) * ceil(480/16) = 1200 macroblocks/s = macroblocks * 30 = 36000
the reason ceil
non-mod16 resolution padded multiple of 16.
you take @ h.264 levels. within frame size limit 2.2
1620
max decoding speed greater 20252
have choose next level wich 3
. you'll have consider maximum bitrate baseline
profile in table.
if have android device can download h.264 calculator app amazon app store (i can send apk
if don't orwellian app permissions)
the x264
encoder automatically choose level based on encoding parameters. vlc
can set flag using like:
--sout="#transcode{vcodec=h264,venc=x264{profile=baseline,level=22}"...
beware, sets encoder output flag , doesn't produce level 2.2
stream. can put values want, it's possible mark full hd stream @ 60 fps level 2.2
if it's level limits.
vlc transcoding
if want make sure you're sending correct stream you'll need transcode source material. example 640x480 @ 30 fps results in level 3
h.264 stream showed above. if want level 2.2
you'll need lower resolution or framerate or both. video bitrate can go lower in case.
cvlc input.mp4 --sout="#transcode{vcodec=h264,venc=x264{profile=baseline},fps=30,width=640,height=480,vb=1372,acodec=mpga,ab=128,channels=2,samplerate=44100}:rtp{...}
mediainfo
mediainfo great tool information media file. can check specs of input files, won't detect wrong level forced or wrongfully chosen encoder. safest way re-encode.
Comments
Post a Comment