FAQ  •  Register  •  Login

maxVBitrate not adhered to?

<<

stephendhill

Serviio lover

Posts: 59

Joined: Sat Jan 30, 2010 9:59 am

Location: UK

Post Sun Sep 30, 2012 9:16 am

maxVBitrate not adhered to?

I was having dropouts with a couple of mp4 files, over powerline AV200 devices. So I decided to investigate.
I built ffmpeg myself for Ubuntu:
  Code:
ffmpeg version git-2012-09-16-a593f5b Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 16 2012 20:07:02 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-libvpx --enable-librtmp --enable-libxvid --cpu=core2
  libavutil      51. 73.100 / 51. 73.100
  libavcodec     54. 56.100 / 54. 56.100
  libavformat    54. 27.101 / 54. 27.101
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3. 16.104 /  3. 16.104
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100

First off, my Samsung B series tv does NOT like any mp4 files I have come across. I also wanted to restrict the bandwidth to something the powerline devcies would take.
The original file is showing high peaks:
bitrate_test..gif
Original file bitrate
bitrate_test..gif (48.89 KiB) Viewed 871 times

Therefore I changed the profile to this:
  Code:
<Video targetContainer="mpegts" targetACodec="ac3" targetVCodec="mpeg2video" maxVBitrate="15360">
                <Matches container="asf" vCodec="wmv2" />
                <Matches container="matroska" vCodec="mpeg2video" />
                <Matches container="matroska" vCodec="vp8" />
                <Matches container="avi" vCodec="mjpeg" />
                <Matches container="avi" vCodec="dvvideo" />
                <Matches container="mp4" vCodec="mjpeg" />
                <Matches container="flv" />
                <Matches container="ogg" />               
                <Matches container="mp4"/>
             </Video>

The debug log shows:
  Code:
2012-09-30 08:35:07,882 DEBUG [MediaItemDAOImpl] Getting file of media item 11890
2012-09-30 08:35:07,883 DEBUG [FFMPEGWrapper] Invoking FFmpeg to transcode video file: /shared_data2/video/cartoons/Test.mp4
2012-09-30 08:35:07,883 DEBUG [ProcessExecutor] Starting /shared_data/serviio/serviio-1.0.1/bin/ffmpeg -i /shared_data2/video/cartoons/Test.mp4 -y -threads 1 -copyts -c:v mpeg2video -b:v 15360k -maxrate:v 15360k -bufsize:v 15360k -r 24000/1001 -g 15 -c:a ac3_fixed -b:a 192k -ac 2 -map 0:0 -map 0:1 -sn -f mpegts /tmp/Serviio/transcoding-temp-11890-2-ORIGINAL.stf
2012-09-30 08:35:08,384 DEBUG [FileBasedTranscodingDeliveryStrategy] Sending transcoding stream
2012-09-30 08:35:08,384 DEBUG [VideoDeliveryEngine] Found Format profile for transcoded file Test.mp4: MPEG_TS_SD_EU_ISO
2012-09-30 08:35:08,384 DEBUG [VideoDeliveryEngine] Found Format profile for transcoded file Test.mp4: MPEG_TS_SD_NA_ISO
2012-09-30 08:35:08,384 DEBUG [VideoDeliveryEngine] Found Format profile for transcoded file Test.mp4: MPEG_TS_SD_KO_ISO

Which looks like it is taking the setting.
BUT when I use Bitrate Viewer I See:
bitrate_test_after_transcode.gif
Transcoded test file bitrate
bitrate_test_after_transcode.gif (50.75 KiB) Viewed 871 times

Which has higher peaks and a higher average!
What's going on???
Avid Serviio user
Pure Evoke Flow | Samsung LE40B650 | Samsung UE40F6320 | Sony PS3 | Ubuntu 12.04
<<

Illico

User avatar

DLNA master

Posts: 4420

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Sun Sep 30, 2012 9:22 am

Re: maxVBitrate not adhered to?

A high h264 peak bitrate will be a VERY HIGH peak bitrate in mpeg2video codec.
But you are right, it seems that "-b:v 15360k -maxrate:v 15360k -bufsize:v 15360k" is not taking into account.
Could you retry locally the same command line (in a new console) and see the ffmpeg log ?
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

stephendhill

Serviio lover

Posts: 59

Joined: Sat Jan 30, 2010 9:59 am

Location: UK

Post Sun Sep 30, 2012 3:40 pm

Re: maxVBitrate not adhered to?

  Code:
/shared_data/serviio/serviio-1.0.1/bin/ffmpeg -i "/shared_data2/video/cartoons/Test.mp4" -y -threads 1 -copyts -c:v mpeg2video -b:v 15360k -maxrate:v 15360k -bufsize:v 15360k -r 24000/1001 -g 15 -c:a ac3_fixed -b:a 192k -ac 2 -map 0:0 -map 0:1 -sn -f mpegts /tmp/Serviio/transcoding-temp-11890-2-ORIGINAL-manual.stf
ffmpeg version git-2012-09-16-a593f5b Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 16 2012 20:07:02 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-libvpx --enable-librtmp --enable-libxvid --cpu=core2
  libavutil      51. 73.100 / 51. 73.100
  libavcodec     54. 56.100 / 54. 56.100
  libavformat    54. 27.101 / 54. 27.101
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3. 16.104 /  3. 16.104
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/shared_data2/video/cartoons/Test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isom
    creation_time   : 1942-05-24 10:41:38
  Duration: 01:35:23.86, start: 0.000000, bitrate: 2452 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1216x720 [SAR 1:1 DAR 76:45], 1999 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
    Metadata:
      creation_time   : 1942-05-24 16:39:38
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 5.1, s16, 447 kb/s
    Metadata:
      creation_time   : 1942-05-24 10:45:07
      handler_name    : GPAC ISO Audio Handler
[mpeg2video @ 0x9443200] impossible bitrate constraints, this will fail
[mpegts @ 0x9442d00] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to '/tmp/Serviio/transcoding-temp-11890-2-ORIGINAL-manual.stf':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isom
    encoder         : Lavf54.27.101
    Stream #0:0(und): Video: mpeg2video, yuv420p, 1216x720 [SAR 1:1 DAR 76:45], q=2-31, 15360 kb/s, 90k tbn, 23.98 tbc
    Metadata:
      creation_time   : 1942-05-24 16:39:38
    Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s
    Metadata:
      creation_time   : 1942-05-24 10:45:07
      handler_name    : GPAC ISO Audio Handler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg2video)
  Stream #0:1 -> #0:1 (aac -> ac3_fixed)
Press [q] to stop, [?] for help
frame= 1077 fps=109 q=2.0 Lsize=   23617kB time=00:00:44.87 bitrate=4311.0kbits/s dup=2 drop=0
video:20694kB audio:1046kB subtitle:0 global headers:0kB muxing overhead 8.635173%

Hmmm, this is showing:
  Code:
[mpeg2video @ 0x9443200] impossible bitrate constraints, this will fail
[mpegts @ 0x9442d00] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts

What do I do about that?
Avid Serviio user
Pure Evoke Flow | Samsung LE40B650 | Samsung UE40F6320 | Sony PS3 | Ubuntu 12.04
<<

stephendhill

Serviio lover

Posts: 59

Joined: Sat Jan 30, 2010 9:59 am

Location: UK

Post Mon Oct 01, 2012 12:03 pm

Re: maxVBitrate not adhered to?

Interestingly if I change -maxrate:v to 18360, I don't get the "impossible bitrate constraints, this will fail" error; I am getting "rc buffer underflow" errors though (what does that mean?). I have read on some forums that making the average bitrate the same as the max bitrate is a bit of a no-no.....
Avid Serviio user
Pure Evoke Flow | Samsung LE40B650 | Samsung UE40F6320 | Sony PS3 | Ubuntu 12.04
<<

robertsearle

Serviio lover

Posts: 62

Joined: Mon May 07, 2012 6:13 pm

Post Sun Nov 11, 2012 7:40 pm

Re: maxVBitrate not adhered to?

Are you using serviio 1.0.0 or 1.0.1? This sounds like the 1.0.0 bug!

Return to Transcoding

Who is online

Users browsing this forum: Google [Bot] and 2 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.