Lets say I have 30 frames in a xvid avi file and I only want to use those 30 frames (1 second in video time).
- I want the first frame to display for 1 second
- I want the remaining frames up to 25 to be 1/30 frames and the rest to display on the video for 2 seconds.
Is this possible?
---
Background:
I have already imported a series of jpg images in virtualdub and made a compressed avi out of it. It's arounf 4.5k and looks great although I have no control over the frames to delay.
The equivalent gif version made from the same set of images is around 4 meg.
I could just repeat the jpg images I want to delay but I want to use the least amount of frames possible.
The reason I want to do this is because:
File size is reduced drastically compared to an optimized gif
Looks better
Time taken optimizaing the gif is reduced to over 90%
It's not for browser support so I don't care about that
+ Reply to Thread
Results 1 to 8 of 8
-
-
AVI doesn't support variable frame rates so you can't display some frames for longer than others unless you duplicate them. If you're using an intra-frame codec (Xvid) exact duplicate frames will cost you almost nothing.
Last edited by jagabo; 13th Apr 2013 at 08:30.
-
thx for the reply, I will experiment repeating frames and see how much bigger the file size is.
It has come to my attention the QuickTime movie format officially supports embedding image sequences and giving each image a separate display duration. . . I will look into this.
I also notice some formats support VFR
http://en.wikipedia.org/wiki/Comparison_of_container_formats#cite_note-Matroska_VBR.2FVFR-12
As long as it works, does ayone have any reccomendations which format would be easiest to work/edit with to do what I want? -
-
Easiest would be to use a timecodes file, and mkvmerge . Or something like x264 with --tc-file
There are several types of timecodes files, for your purposes , v1 is the easiest. Make a text file
Code:# timecode format v1 assume 1 0,0,1 1,25,30 26,29,0.4
0,0,1 means from frame 0 to 0 , assume 1 fps
1,25,30 means from frame 1 to 25, assume 30 fps
26,29,04 means from frame 26 to 29, assume 0.4 fps
Of course , you have to adjust it to the proper values; it's not clear if you mean 1/30 as 30 fps, or 29.97 , but you get the idea
Note, numbering begins at zero
In MKVtoolnix, you can add the video, highlight the video track, in the format specific options tab, in the timecodes box push browse, and select your timecodes file (e.g. "timecodes.txt") , push start muxing
Alternatively you can do this directly with x264 using --tcfile-in . In this example, 1.avs was an avisynth file that made blankclip for test purposes, but it can be any type of input . For example, if you had a jpg sequence you could use ImageSource(). If you already have the video encoded, it would be better to use the mkvtoolnix method (no quality loss)
e.g
Code:x264 --crf 18 --preset slower --tcfile-in "tc.txt" -o vfr.mp4 1.avs
The example attached is below -
I think my math was wrong in that example, it should be 0.5 fps for 4 frames = 2 seconds, not 0.4 fps . But you get the idea
-
Thx for all the replies.
This is great, fluid and straightforward method with MKVToolnix once you know which frames you want to edit delay-wise.
I made a variable frame rate (or a timecoded) MKV file from an AVI file of 434KB whose equivalent gif is over 4mb (optimized!) using exactly the same amount of frames.Meaning I can pretty much save alot of time from optimizing gifs and they look better.
Apart from my intended personal use I think it will only be a matter of time before browsers start using these instead of gifs/ I guess. -
gifs are completely different in that they use a limited color pallete eg. 256 colors . But with video compression (such as h.264) you can also use temporal compression and chroma subsampling
VFR is already supported through FLV or MP4 and flash, and WMV (and have been for many years) . They are commonly used for streaming purposes to conserve bandwidth
MKV is not supported except through WEBM and HTML5 (and I'm uncertain if VFR is supported there for WEBM, but it shoudl be)
(Your MKV with AVI example wouldn't play through a web browser in flash, for example, because it used xvid compression, not supported ; but if you did the same thing in the 2nd example, you will note it does stream)
Similar Threads
-
datamosh: all I frames in video: how to get p frames?
By botzi in forum Newbie / General discussionsReplies: 15Last Post: 6th Jan 2013, 11:28 -
decoding mpeg video into frames say I,P,B frames
By abeer in forum ProgrammingReplies: 44Last Post: 6th Oct 2012, 08:24 -
streaming video w/o delay
By newToSream in forum Video Streaming DownloadingReplies: 0Last Post: 17th Feb 2012, 08:36 -
creating small mpeg with delay between frames
By nighthawk2018 in forum Newbie / General discussionsReplies: 11Last Post: 30th Dec 2009, 09:56 -
How to delay video?
By nick256 in forum Newbie / General discussionsReplies: 2Last Post: 24th Jan 2009, 23:51