VideoHelp Forum
+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 31 to 36 of 36
Thread
  1. Originally Posted by vongooB9 View Post
    Originally Posted by einstein1969 View Post
    unfortunately, I found mp4 files where the bitrate was missing.
    Thanks for testing it, I will note it for my programs. Unfortunately I can't think of any other method that someone else hasn't already mentioned. But if you are going to convert mp4 to mkv I think it is better to use mkvmerge instead of ffmpeg, this way you don't need to use mkvpropedit, because mkvmerge already adds the bitrate directly.

    Code:
    mkvmerge -o output.mkv input.mp4
    Going to look with the Mediainfo GUI I found out that the files that looked like MP4 actually had TS format. The other mp4s I have all have the information (bitrate, etc). So it's like you said.
    Quote Quote  
  2. Member
    Join Date
    Jul 2022
    Location
    Spain
    Search Comp PM
    Originally Posted by einstein1969 View Post
    I have a problem, the conversions with mkvmerge and ffmpeg come with different sizes from each other and with the original. Original 587MiB, mkmerge 548 MiB, ffmpeg 568 MiB

    Is this normal?

    EDIT: Going to look with the Mediainfo GUI I found out that the files that looked like MP4 actually had TS format. Could this be what created that size difference?
    The size difference with the original is totally normal, and it is also normal that there are differences between mkvmerge and ffmpeg, but in this case the difference is quite big. When I have tested it the difference was not more than 1 or 2MiB in files of similar size to yours. As they are very different programs they do everything differently. Normally generic utilities like ffmpeg are less efficient than specific ones like mkmerge.
    Quote Quote  
  3. New user
    Join Date
    Nov 2023
    Location
    Europe
    Search Comp PM
    Originally Posted by einstein1969 View Post
    Originally Posted by Swedaniel View Post
    Originally Posted by einstein1969 View Post
    Hi, I'm using Mediainfo to take the average bitrate of a video but I've found that many times it's not there.

    I have two questions:

    1) what other ways are there to get the average bitrate?

    2) If there are more than one way, what parameters can you count on? That is, what parameters are definitely present?
    Hi, it took some time for me to realise, but this one program called 'Avanti' have an feature called Bitrate/Filesize Calculator. Ive been using v.0.9.2 together with FFMpeg Essentials v.6.0 and it is working pretty good! This bitrate calculator will display the source files duration (time in hour/minute/seconds), and allso it is possible to click 'Calc bitrate' and it will display the source files bitrate, the video i tested the bitrate calc with have variable bitrate (VBR) and it display an pretty accurate estimate of the bitrate that ive compared the bitrate with an other program, ellse it say in the program it is mostly reliable with CBR (Constant Bitrate), it seem to be working fine with VBR allso!.. (You can find this function on the right side of 'Bitrate Kbit/s and it is an button 'C' to click on which wil load the Bitrate calculator).

    The program is avalible for download here on VideoHelp, it is allso required to aqquire FFMpeg for this program to function which can be found here (FFMpeg) aswell in many different version.
    sorry I forgot to mention that I'm using mediainfo CLI. I need to create a cmd batch.

    No Worries, it would not have help much anyway, after testing the bitrate calculator myself a lil bit more it was apparently an file size calculator, ie. if adding 400 bitrate it was possible to calculate the file size of this video with the added bitrate of 400 (if converting into this). funnily the video i compared with had basicy same bitrate as the input!
    Quote Quote  
  4. Originally Posted by pandy View Post
    Originally Posted by einstein1969 View Post
    Originally Posted by pandy View Post
    You can extract elementary streams and calculate average bitrate based on this, containers always add some overhead so overall file size is bigger than sum of all elementary streams sizes - there is many reasons for this - for example packetization, metadata, container structure etc.
    So whenever you need to know average video bitrate go for video elementary stream and calculate it by yourself.
    Btw mediainfo frequently may provide inaccurate informations.
    Thanks to you, your solution is the one that should work. It's heavy in terms of pc work, but I don't see any other solution. Since I don't need a precise value, I'm undecided whether to extract the audio tracks, to do it first, and make the difference. I have to do some tests... Thank you, thank you, thank you.
    You can use ffprobe to output each frame size in bits - all bits added together and divided by duration will give average video bitrate - this can be done semiautomatically.

    You can use script from here https://forum.videohelp.com/threads/412226-Losslessly-Extract-Keyframes#post2711854

    pkt_duration_time and pkt_size is most interesting for you - add all pkt_duration_time together and it will give duration ; add all pkt_size together and multiply by 8 so you get bits then divide this by calculated duration and you will get correct average bitrate.
    I wanted to calculate with this method to understand the size since the previous methods give substantial differences on the size. After 20 minutes of processing I had the csv file. But when I looked for the columns concerned, I found that they always had the same values. Looking more closely I realized that the header is different from the data.

    Code:
    1      2	 3	      4	        5	6	     7	     8	          9			10			   11	        12		  13	  14      15     16
    entry,media_type,stream_index,key_frame,pkt_pts,pkt_pts_time,pkt_dts,pkt_dts_time,best_effort_timestamp,best_effort_timestamp_time,pkt_duration,pkt_duration_time,pkt_pos,pkt_size,width,height,pix_fmt,sample_aspect_ratio,pict_type,coded_picture_number,display_picture_number,interlaced_frame,top_field_first,repeat_pict,color_range,color_space,?,?,chroma_location > "%~n1.csv"
    
    1     2     3 4 5     6        7     8        9     10       11   12       13   14       15    16    17   18
    frame,video,0,1,97265,1.080722,97265,1.080722,97265,1.080722,1501,0.016678,1501,0.016678,99828,52138,3840,2160,0,0,0,0,yuv420p,1:1,I,0,0,0,0,0,tv,unknown,unknown,unknown,left,H.26[45] User Data Unregistered SEI message
    frame,video,0,0,98766,1.097400,98766,1.097400,98766,1.097400,1501,0.016678,1501,0.016678,316968,52135,3840,2160,0,0,0,0,yuv420p,1:1,B,0,0,0,0,0,tv,unknown,unknown,unknown,left
    frame,video,0,0,100268,1.114089,100268,1.114089,100268,1.114089,1501,0.016678,1501,0.016678,262636,52136,3840,2160,0,0,0,0,yuv420p,1:1,B,0,0,0,0,0,tv,unknown,unknown,unknown,left
    frame,video,0,0,101769,1.130767,101769,1.130767,101769,1.130767,1501,0.016678,1501,0.016678,371300,52135,3840,2160,0,0,0,0,yuv420p,1:1,B,0,0,0,0,0,tv,unknown,unknown,unknown,left
    frame,video,0,0,103271,1.147456,103271,1.147456,103271,1.147456,1501,0.016678,1501,0.016678,208492,52135,3840,2160,0,0,0,0,yuv420p,1:1,B,0,0,0,0,0,tv,unknown,unknown,unknown,left
    frame,video,0,0,104772,1.164133,104772,1.164133,104772,1.164133,1501,0.016678,1501,0.016678,479776,52136,3840,2160,0,0,0,0,yuv420p,1:1,B,0,0,0,0,0,tv,unknown,unknown,unknown,left
    frame,video,0,0,106274,1.180822,106274,1.180822,106274,1.180822,1501,0.016678,1501,0.016678,425444,52135,3840,2160,0,0,0,0,yuv420p,1:1,B,0,0,0,0,0,tv,unknown,unknown,unknown,left
    frame,video,0,0,107775,1.197500,107775,1.197500,107775,1.197500,1501,0.016678,1501,0.016678,154160,52135,3840,2160,0,0,0,0,yuv420p,1:1,P,0,0,0,0,0,tv,unknown,unknown,unknown,left
    frame,video,0,0,109277,1.214189,109277,1.214189,109277,1.214189,1501,0.016678,1501,0.016678,696916,52135,3840,2160,0,0,0,0,yuv420p,1:1,B,0,0,0,0,0,tv,unknown,unknown,unknown,left
    frame,video,0,0,110778,1.230867,110778,1.230867,110778,1.230867,1501,0.016678,1501,0.016678,642584,52136,3840,2160,0,0,0,0,yuv420p,1:1,B,0,0,0,0,0,tv,unknown,unknown,unknown,left
    frame,video,0,0,112280,1.247556,112280,1.247556,112280,1.247556,1501,0.016678,1501,0.016678,751060,52135,3840,2160,0,0,0,0,yuv420p,1:1,B,0,0,0,0,0,tv,unknown,unknown,unknown,left
    
    ...
    Specifically, look at the size of the frames from column 15 of the header to column 17 of the data. Do you know where I can find the right header?
    Quote Quote  
  5. Member
    Join Date
    Jul 2022
    Location
    Spain
    Search Comp PM
    This ffmpeg command saves in a csv file all the frame metadata, depending on the format they may be different. As you are only interested in some of them you can change the -show_entities parameter and save only the data you are interested in. This only extracts the size:

    Code:
    -show_entries frame=pkt_size
    But this method uses pkt_size which is not exactly the size of the frame but the size of the packet. Although it is usually the same depending on the format it might not be.

    You can also try using ffmpeg, if remux the file at the end it shows the size of the different streams types and the duration.

    Code:
    ffmpeg -i file.mp4 -c copy -f null -
    Output:

    Code:
    video:169601kB audio:22800kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown size=N/A time=00:23:51.46 bitrate=N/A speed=1.85e+03x
    But regardless of the method you use, there will always be differences.
    Quote Quote  
  6. First of all, thank you. At this point I surrender to the very big differences. I'll do all the methods and take the biggest bitrate. For the moment I think I have solved it thanks to your precious help. Now that I have the bitrate secured, I'll have to move on to re-encoding the video and audio and I'll open another thread.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!