简体   繁体   中英

ffmpeg bitrate 10% bigger than requested

A simple question. I have an ffmpeg script.

I request -b:v:0 1000k but get the output BANDWIDTH=1100000 in my master playlist - I was expecting BANDWIDTH=1000000

As you can see there are no audio streams. Why is the BANDWIDTH 10% bigger on every occasion than the requested bitrate?

Thanks in advance. Script and output follow.

Script:

ffmpeg -i rgb.mp4 -hide_banner # dump video stream info

rm -rf hls

ffmpeg -i rgb.mp4 \
  -v warning -preset ultrafast -g 60 -sc_threshold 0 \
  -map 0:0 -map 0:0 -map 0:0 -map 0:0 \
  -s:v:0 1440x1080 -c:v:0 libx264 -b:v:0 1000k \
  -s:v:1 1440x1080 -c:v:1 libx264 -b:v:1 2000k \
  -s:v:2 1920x1440 -c:v:2 libx264 -b:v:2 3000k \
  -s:v:3 1920x1440 -c:v:3 libx264 -b:v:3 4000k \
  -var_stream_map "v:0 v:1 v:2 v:3" \
  -master_pl_name master.m3u8 -f hls \
  -hls_time 6 -hls_list_size 0 -hls_playlist_type vod \
  -hls_segment_filename "hls/v%v/chunk%d.ts" "hls/v%v/index.m3u8"

cat hls/master.m3u8

Output:

$ sh ./ffmpeg-test-script.sh
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'rgb.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2021-08-03T11:45:50.000000Z
    encoder         : Lavf59.4.102
  Duration: 00:00:50.04, start: 0.000000, bitrate: 37415 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1920x1440, 37412 kb/s, 30 fps, 30 tbr, 19200 tbn (default)
    Metadata:
      creation_time   : 2021-08-03T11:45:50.000000Z
      handler_name    : Core Media Video
      vendor_id       : [0][0][0][0]
    Side data:
      displaymatrix: rotation of -180.00 degrees
At least one output file must be specified
[swscaler @ 000001fae15daf00] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 000001faef115ec0] deprecated pixel format used, make sure you did set range correctly
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=1100000,RESOLUTION=1440x1080,CODECS="avc1.42c028"
v0/index.m3u8

#EXT-X-STREAM-INF:BANDWIDTH=2200000,RESOLUTION=1440x1080,CODECS="avc1.42c028"
v1/index.m3u8

#EXT-X-STREAM-INF:BANDWIDTH=3300000,RESOLUTION=1920x1440,CODECS="avc1.42c032"
v2/index.m3u8

#EXT-X-STREAM-INF:BANDWIDTH=4400000,RESOLUTION=1920x1440,CODECS="avc1.42c032"
v3/index.m3u8

First you specify the video bit rate for the x264 encoder which is only for the bits coming out of the encoder. The BANDWIDTH parameter in the HLS playlist includes the container (MPEG-2 Transport Stream) overhead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM