Hi
It's a movie with redundant frames. Let's concentrate on a part of it I uploaded:
https://drive.google.com/file/d/1ndHrGElxIDaM4MWAK98UvauziSr2f68N/view?usp=sharing
The sample got from the movie contains 32 frames. When I open the video in Avidemux, I see that only these frames differ with their previous frames (I specify them with * and specify all frames types (I, B or P)):
No. type time
----- ----- -----
*0 I 020 (It's evident that the first frame which is a key frame should contain data)
1 B 030
2 B 040
3 P 050
*4 B 060
5 B 070
6 B 080
7 P 090
*8 B 100
*9 B 110
10 B 120
*11 B 130
*12 P 140
13 B 150
14 B 160
15 P 170
*16 B 180
*17 B 190
*18 B 200
*19 B 210
*20 P 220
21 B 230
22 B 240
23 P 250
*24 B 260
25 B 270
26 B 280
27 P 290
*28 B 300
*29 B 310
30 B 320
31 P 330
My question is:
Why the other frames are there in the movie while they don't contain any move? I wrote a C program on Ubuntu to use libavxxx and found that all frames have data. When a frame causes no change in its previous image, why should it exist? I feel that something is wrong with the movie and the whole size may be decreased if the redundant frames may get out of the movie. Don't you think so? If you think I'm correct, how can I correct the movie?
Thanks
+ Reply to Thread
Results 1 to 24 of 24
-
-
I include the output of the program which dumps the content of each frame separately:
https://pastebin.com/ZqnmppD4
You see that all have data while most don't cause change in image. -
First of all, there are duplicate frames because a video of a lower frame rate was converted to a constant 100 fps. Secondly, there are more duplicates than you think. There are really only 7 unique frames out of the 32. Which makes the underlying frame rate about 23 fps. As manono suggested, a longer sample would be good. And include a medium speed panning shot to make analysis easier.
-
Why not? I thought the sample might be enough and if I didn't upload the whole movie it was because of volume as well as copyright issues.
Here:
https://drive.google.com/file/d/1Ryaa1FJ7yxiJkiV1ABNMBXScMhHbDQdN/view?usp=sharing -
It was originally 25p. Someone converted to 100p by duplicating frames. Attached is 9 seconds decimated to 25p.
Code:LWLibavVideoSource("boys will be boys_2.mp4", cache=false, prefer_hw=2) SelectEvery(4) # discard 3 of every 4 frames, converting 100p to 25p Trim(18100, 18341) # select a panning shot (easy to check for smoothness)
Last edited by jagabo; 20th Apr 2021 at 19:32.
-
Thank you. How did you find that it has been originally a 25 fps video? And how can I convert the whole movie to a proper fps? (I prefer ffmpeg).
The video is once converted from H264 to H265 by me and I doubt that has been my mistake in changing frame rate. I used something like:
Code:ffmpeg -i <file1> -c:v libx265 -map 0 <file2>
-
Stepping through the video frame by frame you can see four identical frames in a row. Like AAAABBBBCCCCDDDD... 100/4 = 25.
Obviously, that command line should not have changed the frame rate from 25p to 100p.
ffmpeg has a decimate filter:
Code:ffmpeg -i 100p.mp4 -vf decimate=2,decimate=2 25p.mp4
-
I got the proper answer I was looking for, thanks.
I mostly use ffmpeg. So it's not a problem if you don't know its equivalent filter to AviSynth. I think it's a more professional tool.
Just let me know what's the decimate filter. Could I use decimate=4 instead? What does it do and why did you use it two times? -
No, you can't use decimate=4. The decimate filter in ffmpeg removes 1 in N frames. So decimate=4 removes 1 of every 4 frames reducing the frame rate from 100 to 75 fps. I used decimate=2 to reduce the frame rate to 50 fps then again to further reduce it to 25 fps.
The decimate filter in AviSynth can remove M in N frames. So you can go directly from 100 fps to 25 fps with Decimate(Cycle=4, CycleR=3) (remove 3 of every 4 frames). -
Oh okay,
Can it detect I-frames so that no re-encoding will be required? I don't want to re-encode and cause downgrading quality. -
-
I converted the video as you guided. The frame rate got corrected and the redundant frames got disappeared. But it's weird that no reasonable change in size occurred. The 264.3 MB file got 250.9 MB in size. Usually if I re-encode a video without changing frame rate such a change in volume takes place. So, I can deduce that the redundant frames in the original video didn't occupy such a reasonable volume of the file. I would expect the file size to reduce to about half or less!
-
-
Code:
stream size = bitrate * running time
-
@davexnet: I didn't specify bitrate change for ffmpeg. So if it's changed, it has been its own decision. The original video's bitrate is 282kbps and the converted one's bitrate is 269kbps.
@jagabo: Your text is higher level than my knowledgeI think a newbie like me can't understand it completely, but I try my best. It's a good formula I didn't know about. It shows that any stream size depends only on bitrate as well as its running time, not frame rate. It concludes that a 1000fps video is the same in size as its 1fps equivalent in runtime. It's weird. How can it be possible? So where do these additional data go? I saw in the program I wrote that even these duplicate and redundant frames have size and so they need additional bitrate.
I don't know any about CRF encoding. What is it?
I also don't know what you mean by frame rate awareness. The same for 'defects'. Sorry, I'm really a newbie in such matters. -
The definition of bitrate is:
Code:bitrate = stream size / running time
Code:stream size = bitrate * running time
Code:ffmpeg -i <file1> -c:v libx265 -map 0 <file2>
-
I don't know if there's an equivalent to AviSynth's SelectEvery() filter.users currently on my ignore list: deadrats, Stears555, marcorocchini
-
Thanks for the input. I tried shuffleframes but I couldn't get it to remove frames, only reorder frames or replace frames with copies of others. The docs say using -1 deletes that frame but "shuffleframes=0 -1 -1 -1" gives four copies of frame 0. Frames 1, 2, and 3 were replaced with copies of frame 0, not removed. Am I missing something?
-
A quick test with:
Code:ffplay -i "f:\TestClips&Co\files\5000frames.mp4" -vf shuffleframes="0 -1 -1 -1"
returns frames 0, 4, 8, 12, ... which is what I would have expected,..
(split source in packages of 4, keep the first frame drop the rest)
-> what does your call look like exactly? (missing quotes?)users currently on my ignore list: deadrats, Stears555, marcorocchini -
-vf shuffleframes does not automatically adjust the timestamps
everything in ffmpeg runs on timestamps, and most filters do not auto adjust like avisynth filters (e.g. if you use selecteven or similar, the fps and their timestamps will automatically be cut in half)
so you'd have to follow up with something like -vf fps for this situation where you have 100fps, keeping 1 of 4
5min test
Code:ffmpeg -i "boys will be boys_2.mp4" -vf "shuffleframes='0 -1 -1 -1', fps=25" -c:v libx264 -crf 20 -c:a copy -t 00:05:00 out.mp4 -y
-
Similar Threads
-
Patch encoder to force P-Frames to only reference I-Frames
By zombiitv in forum ProgrammingReplies: 1Last Post: 9th Sep 2019, 21:51 -
How to get rid of redundant MiniDV audio stream
By kodec in forum Video ConversionReplies: 2Last Post: 10th Jul 2018, 16:40 -
Can I force ffmpeg to transcode 59.94 frames to display at 25 frames per se
By oduodui in forum EditingReplies: 4Last Post: 28th Apr 2018, 09:24 -
Replace random duplicate frames with black frames (AVISYNTH)
By benzio in forum EditingReplies: 7Last Post: 31st Jan 2018, 16:43 -
Various (redundant)
By Tombs in forum Video Streaming DownloadingReplies: 126Last Post: 26th Dec 2017, 22:40