Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > High Efficiency Video Coding (HEVC)

Reply
 
Thread Tools Search this Thread Display Modes
Old 31st August 2021, 12:20   #1  |  Link
reko
Registered User
 
Join Date: Apr 2013
Posts: 7
Strange, Video bitrate is changed after trim the video with ffmpeg

Original Video is mkv file :
Code:
Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 5 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 2 h 11 min
Bit rate                                 : 9 173 kb/s
Width                                    : 1 920 pixels
Height                                   : 808 pixels
Display aspect ratio                     : 2.40:1
Frame rate mode                          : Constant
Frame rate                               : 24.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.246
Stream size                              : 8.44 GiB (86%)
Writing library                          : x264 core 159 r2991 1771b55
Encoding settings                        : cabac=1 / ref=5 / deblock=1:-3:-3 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=24 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=2pass / mbtree=1 / bitrate=9173 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
Language                                 : English
Default                                  : Yes
Forced                                   : No
Then I encode it with ffmpeg :
Code:
ffmpeg -i "Parasite.mkv" -c:v libx265 -preset ultrafast -acodec ac3 -b:a 448k -map 0 ParasiteReduced.mkv
The result (at least for me) still watchable on 42" TV although the video bitrate is only 342 kb/s from 9173 kb/s
ParasiteReduced.mkv Media Info :
Code:
Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L4@Main
Codec ID                                 : V_MPEGH/ISO/HEVC
Bit rate                                 : 342 kb/s
Width                                    : 1 920 pixels
Height                                   : 808 pixels
Display aspect ratio                     : 2.40:1
Frame rate mode                          : Variable
Original frame rate                      : 24.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Writing library                          : x265 3.0_Au+10-74a8672ea4f7:[Windows][GCC 8.2.1][64 bit] 8bit+10bit
Encoding settings                        : cpuid=1111039 / frame-threads=3 / numa-pools=8 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=1920x808 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=1 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=24 / keyint=250 / gop-lookahead=0 / bframes=3 / b-adapt=0 / b-pyramid / bframe-bias=0 / rc-lookahead=5 / lookahead-slices=5 / scenecut=0 / radl=0 / no-splice / no-intra-refresh / ctu=32 / min-cu-size=16 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=0 / dynamic-rd=0.00 / no-ssim-rd / no-signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=2 / limit-refs=0 / no-limit-modes / me=0 / subme=0 / merange=57 / temporal-mvp / no-weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / no-sao / no-sao-non-deblock / rd=2 / early-skip / rskip / fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=0.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=28.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=1 / aq-strength=0.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=2 / transfer=2 / colormatrix=2 / chromaloc=0 / display-window=0 / max-cll=0,0 / min-luma=0 / max-luma=255 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / no-hdr / no-hdr-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=5 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=0 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / qp-adaptation-range=1.00
Language                                 : English
Default                                  : Yes
Forced                                   : No
Statistics Tags Issue                    : mkvmerge v7.4.0 ('Circles') 64bit built on Dec 12 2014 12:19:56 2020-01-07 17:45:36 / Lavf58.26.101 
FromStats_BitRate                        : 9168071
FromStats_Duration                       : 02:11:48.839000000
FromStats_FrameCount                     : 189812
FromStats_StreamSize                     : 9063594840
But then after I trim the ParasiteReduced.mkv :
Code:
ffmpeg -ss 01:52:00 -i "ParasiteReduced.mkv" -t 00:03:00 -c copy output.mkv
The Media Info of output.mkv video bitrate is going up from 342 kb/s into 1253 kb/s

Code:
Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L4@Main
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 3 min 1 s
Bit rate                                 : 1 253 kb/s
Width                                    : 1 920 pixels
Height                                   : 808 pixels
Display aspect ratio                     : 2.40:1
Frame rate mode                          : Constant
Frame rate                               : 24.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Bits/(Pixel*Frame)                       : 0.034
Stream size                              : 27.1 MiB (72%)
Writing library                          : x265 3.0_Au+10-74a8672ea4f7:[Windows][GCC 8.2.1][64 bit] 8bit+10bit
Encoding settings                        : cpuid=1111039 / frame-threads=3 / numa-pools=8 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=1920x808 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=1 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=24 / keyint=250 / gop-lookahead=0 / bframes=3 / b-adapt=0 / b-pyramid / bframe-bias=0 / rc-lookahead=5 / lookahead-slices=5 / scenecut=0 / radl=0 / no-splice / no-intra-refresh / ctu=32 / min-cu-size=16 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=0 / dynamic-rd=0.00 / no-ssim-rd / no-signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=2 / limit-refs=0 / no-limit-modes / me=0 / subme=0 / merange=57 / temporal-mvp / no-weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / no-sao / no-sao-non-deblock / rd=2 / early-skip / rskip / fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=0.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=28.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=1 / aq-strength=0.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=2 / transfer=2 / colormatrix=2 / chromaloc=0 / display-window=0 / max-cll=0,0 / min-luma=0 / max-luma=255 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / no-hdr / no-hdr-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=5 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=0 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / qp-adaptation-range=1.00
Language                                 : English
Default                                  : Yes
Forced                                   : No
Statistics Tags Issue                    : mkvmerge v7.4.0 ('Circles') 64bit built on Dec 12 2014 12:19:56 2020-01-07 17:45:36 / Lavf58.26.101 
FromStats_BitRate                        : 9168071
FromStats_Duration                       : 00:03:01.612000000
FromStats_FrameCount                     : 189812
FromStats_StreamSize                     : 9063594840
3 Minutes Sample HEVC Video - 38 Mb - Video Bitrate 1253 kb/s

I wonder how is the code to trim it with the same video bitrate 342 kb/s ? (Also wonder, why the trimmed video bitrate is going up to almost 4 times than the original video bitrate).

Any kind of help would be greatly appreciated.
Thank you in advanced.
reko is offline   Reply With Quote
Old 31st August 2021, 12:36   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,627
I aint no expert [nor hardly a newbie],
but should the -c copy not be
-vcodec copy
[and if suitable] -acodec copy
I dont know what -c copy is supposed to do.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is online now   Reply With Quote
Old 31st August 2021, 12:43   #3  |  Link
excellentswordfight
Lost my old account :(
 
Join Date: Jul 2017
Posts: 197
The bitrate is varaible, the segment you have trimmed just has more bits spent for that segment.
excellentswordfight is online now   Reply With Quote
Old 31st August 2021, 13:44   #4  |  Link
reko
Registered User
 
Join Date: Apr 2013
Posts: 7
Hi StainlessS,
thank you for your respond.

Quote:
Originally Posted by StainlessS View Post
I aint no expert [nor hardly a newbie],
but should the -c copy
The copying a portion of ParasiteReduced use -c copy, StainlessS.

Quote:
not be
-vcodec copy
I don't have -vcodec copy .
reko is offline   Reply With Quote
Old 31st August 2021, 13:52   #5  |  Link
reko
Registered User
 
Join Date: Apr 2013
Posts: 7
Quote:
Originally Posted by excellentswordfight View Post
The bitrate is varaible, the segment you have trimmed just has more bits spent for that segment.
Hi excellentswordfight,
Thank you for your explanation.

Make sense.
So, because the source file (ParasiteReduced.mkv) has a variable bitrate, and the portion I choose (quite many movement - fast camera panning) consequently this portion get more bits spent.
That's why the output.mkv also has more kbps.

BTW, I see that the ParasiteReduced.mkv has a variable bitrate.
I wonder why the output.mkv turn to constant bitrate ?

Thank you once again, excellentswordfight.
reko is offline   Reply With Quote
Old 31st August 2021, 15:25   #6  |  Link
excellentswordfight
Lost my old account :(
 
Join Date: Jul 2017
Posts: 197
Quote:
Originally Posted by reko View Post
Hi excellentswordfight,
Thank you for your explanation.

Make sense.
So, because the source file (ParasiteReduced.mkv) has a variable bitrate, and the portion I choose (quite many movement - fast camera panning) consequently this portion get more bits spent.
That's why the output.mkv also has more kbps.

BTW, I see that the ParasiteReduced.mkv has a variable bitrate.
I wonder why the output.mkv turn to constant bitrate ?

Thank you once again, excellentswordfight.
Are you sure you are not looking at "Frame rate mode"? If the source file has variable bitrate (and it does) then the trimmed stream copy surly does so as well as you do not touch the video.

As to why Frame rate mode is reported as variable in your first re-encode and not the trimmed copy of it, no idea.

Quote:
Originally Posted by reko View Post
Hi StainlessS,
thank you for your respond.

The copying a portion of ParasiteReduced use -c copy, StainlessS.

I don't have -vcodec copy .
You are misunderstanding him, I'm pretty sure that he means that you should use -vcodec copy instead of -c copy. But its fine, -c copy works (and it did work). AFAIK -c copy will just try to copy every stream/component, most users usually specify this per stream type e.g. -vcodec/acodec.

Last edited by excellentswordfight; 31st August 2021 at 15:39.
excellentswordfight is online now   Reply With Quote
Old 7th September 2021, 07:25   #7  |  Link
tonemapped
Video Fanatic
 
tonemapped's Avatar
 
Join Date: Jul 2021
Location: Surrey
Posts: 63
Quote:
Originally Posted by excellentswordfight View Post
The bitrate is varaible, the segment you have trimmed just has more bits spent for that segment.
+1

I often trim segments using avidemux (still works great) and the output depends on the segment, even with 3-pass CBR. On a test 7,500 kbps encode, one segment came out with an average bitrate of under 4,000 kbps, and another at over 9,000 kbps.
__________________
NAS/Enc: Supermicro 48-bay 240TB+ storage | Xeon 1220 v5 | 32GB DDR4 ECC

Just Ordered: 5900X | 32GB 3600 MT/s RAM | 1TB NVMe | RTX 3080

HTPC: J50C | Pentium J5005 | 16GB RAM | 256GB SSD | 15W
tonemapped is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:51.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.