Hello,
I'm still working on transcoding an avi containing a proprietary video stream to an avi containing a h264 one as described here https://forum.videohelp.com/threads/317505-How-to-transcode-proprietary-VWV1-video-to-h264.
A new problem araised (actually the last for an end to end working solution), where a conversion that I can't modify is buggy and I've got to shorten the video that is being transcoded according to following formula:
nb_frames_orginial = fps * nb_frames_converted / 50
This formula tells us that the lower the fps are, the greater the effect of the bug will be. E.g. when a video has 4.16fps, the converted video will contain 12x times the original one. With 50fps everything works fine, but no camera in my setup is using this frame rate...
My problem is that I can't figure out how many frames the video contains.
The solution I've got that is currently working is to transcode the entire video. Mencoder will show the number of frames at the end of the process and I'll extract of the first part that I need.
As gspot is able to show me the exact frame count, I'll figured that their must be a way to get a hold of this number and have a cleaner and more effective solution then what is being done now.
Currently, I need a proprietary tool from VisioWave to make the firsrst (buggy) conversion, then a combination of AviSynth and Mencoder does the rest of the job. If I could avoid having to use more external programs it would be great
Any ideas?
Thanks, Philippe
+ Reply to Thread
Results 1 to 11 of 11
-
-
-
I should have mentioned that I have to do this programmatically. Gspot also shows the right info, but I need a library or a command line tool where I can parse the output to retrieve the number of frames in the video.
I'd like to have this number to tell mencoder to only transcode the relevant part of the video by setting the frame flag.
Currently I transcode the entire movie and get the relevant part afterwards (<--ugly) -
You may be able to script the apps I mentioned.
Also See http://avicodec.duby.info/ for the source code for Avicodec.
Or with Avisynth you can use FrameCount() as Gavino mentioned, and WriteFile() to write it to a text file,
and parse it from there into your app.
http://avisynth.org/mediawiki/WriteFile
Code:WriteFileStart("Framecount.txt", "Framecount()")
-
@Gavino & AlanHK
Thanks, that should do the trick! I'm going to give it a try right away.
Nope, the first step of the transcoding process is to convert an asf container containing a VWV1 video stream using a proprietary VisioWave tool that removes authentication frames and does some other business as well. This transcoding step is buggy and produces a much longer output (according to posted formula) when the video has a lower framerate then 50fps.
What I'm trying to do here, is figure out what the frame rate of the video is, as well as retrieving the total frame count to know how many frames I have to extract (counted from the beginning of the video) in order to compensate the bug that occurs in this first transcode step. I don't really like to do it this way around, as we compensate for a bug, but there is no support for the version of the SDK we have to use.
There are several framerates that are being used as input; 4.26, 8.33, 12.5, 25 and 50. All have to be handled correctly. Currently only the 50fps ones work without a problem. The transcoded h264 streams should use the same frame rate as the input to keep the original information without making the file bigger then it needs to be. -
You can print that out using the same method as framecount, see Clip_properties
-
Now I'm starting to feel a little thick... According to the first example in WriteFile, I've created following script
Code:#define the file where the analysis output will be stored outTextFile = "video_analyze.txt" #open the video that will be analyzed DirectShowSource("asfcheck_allframes.avi", audio=false) #create variables to hold the information that we need nbFrames=Framecount() fps=Framerate() #write the values to file WriteFileStart(outTextFile, "nbFrames") WriteFileEnd(outTextFile, "fps")
I'm using WriteFileStart and End because otherwise the information is outputted for every single frame. (<-- probably not a godd way to do this...)
There must be something I don't get here!?
[edit] I've tried playing with the DirectShowSource parameters (framecount) to shorten the video, but this also modifies the frame count (not that surprising..).
Now I'm trying to find a way to stop playback after having opened the stream. Is that the good way to proceed?Last edited by p.w; 8th Mar 2010 at 03:55.
-
Why not just "WriteFileStart"?
Why make new variables for clip properties? Just print them directly.
You need "append" after the first otherwise each write will overwrite the file.
Code:#write the values to file WriteFileStart(outTextFile, "FrameCount") WriteFileStart(outTextFile, "FrameRate",append = true)
Code:WriteFileStart(outTextFile, "FrameCount",""" " " """, "FrameRate")
Also AvsP, just open the AVS, press F5 to view the first frame, and your data is written. -
You are absolutely right, I'm now using
Code:#define the file where the analysis output will be stored outTextFile = "video_analyze.txt" #open the video that will be analyzed DirectShowSource("convertedVwAvi.avi", audio=false) #write the values to file WriteFileStart(outTextFile, "FrameCount") WriteFileStart(outTextFile, "FrameRate", append = true)
Code:Process p = new Process(); p.StartInfo = new ProcessStartInfo(@"C:\Program Files\Windows Media Player\mplayer2.exe", "/Play \"C:\\dev\\expic\\Wavelet2h264\\Wavelet2h264Tester\\bin\\Debug\\AnalyseAvi.avs\""); p.StartInfo.CreateNoWindow = true; p.Start(); System.Threading.Thread.Sleep(10000); p.Kill();
Thanks a lot to all you gays (and gals?). What I've learned from these two threads helped me a great deal!!!
Similar Threads
-
Bug in VirtualDub (?) -- can't cut desired number of frames
By ralf07 in forum Video ConversionReplies: 3Last Post: 21st Sep 2011, 17:50 -
Megui only processing 1/3 the number of frames
By capvid0429 in forum Video ConversionReplies: 1Last Post: 3rd Jan 2011, 19:28 -
Neither Vegas Video nor WinDV show dropped frames count after capture
By korey99 in forum Capturing and VCRReplies: 13Last Post: 9th Apr 2009, 16:25 -
Burn a DVD - Number of Frames error
By p_uriel in forum Video ConversionReplies: 5Last Post: 21st May 2008, 18:07 -
re-encode while keeping the exact number of frames
By bt04 in forum Video ConversionReplies: 16Last Post: 25th Feb 2008, 19:21