View Full Version : FFmpegSource
TheFluff
15th August 2009, 21:36
If i say this --> Loadplugin("C:\Program Files\AviSynth 2.5\plugins\ffms2.dll")
It works for FFVideoSource() but FFmpegSource2() still says There is no function named "FFMpegSource2()"
For the latter to work you need to say import("C:\Program Files\AviSynth 2.5\plugins\ffms2.avsi") at the top of the script.
In either case it looks like your autoloading is broken. Either you edited the registry value to point somewhere else, or something else did.
edit: or maybe you have two avisynth installations in different places or something
SEt
15th August 2009, 21:41
No floats please if possible. Num/den ints are ok, probably should add total duration too.
About the string: i want it as light and simple way to print on the frame so something like "hh:mm:ss.ttt" with no options, if someone would need fancy formating - it can be done from ints. I kind of dislike what would have to be done inside ScriptClip instead of one line in source.
mavinashbabu
15th August 2009, 21:59
For the latter to work you need to say import("C:\Program Files\AviSynth 2.5\plugins\ffms2.avsi") at the top of the script.
In either case it looks like your autoloading is broken. Either you edited the registry value to point somewhere else, or something else did.
edit: or maybe you have two avisynth installations in different places or something
Hi,
Registry i did not touch at all, and as far as multiple installations of Avisynth i do keep folders and files as backups for but in different drives, but none on where OS installed drive.
I installed Avisynth only once so far and i am using the same installation from 6 months or so. All other plugins in "plugins" folder gets autoloaded automatically though.
I searched for "Avisynth" string in registry all i could see is entries for C:\Windows\system32\Avisynth.dll and C:\Program Files\Avisynth\plugins folders only.
Regards,
Avinash
7ekno
25th August 2009, 03:28
A new version with more experimental fixes. Should fix h264 in TS like in this post http://forum.doom9.org/showthread.php?p=1302028#post1302028 (despite the name too).
Spoke too soon ;)
FFMS2 is only reporting 25fps, when the streams are actually 50fps with duplicate frames!
I know, I know, it's a technicality, but when the streams are encoded at 25fps they appear "more jerky" than those encoded at 50fps with duplicates!! Have even blindly asked a few random people as they walk by my workstation ;)
DSS2() is what I am using to get the right reported 50fps and duplicates atm ...
For clarity, we are talking about these streams:
00000.MTS (http://www.mediafire.com/file/vjzytkenzyi/00000.MTS.rar), 00001.MTS (http://www.mediafire.com/file/lmhn2zzigmg/00001.MTS.rar), 00002.MTS (http://www.mediafire.com/file/madjydtjjx0/00002.MTS.rar)
7ek
Myrsloik
25th August 2009, 09:46
Your claim makes no sense but I've investigated it anyway. As you say it's really a 25 fps video, the repeats don't seem to be flagged in any particular way either. Because of the overly general system in ffmpeg for reporting repeated fields/frames there's no actual way to detect it if all have the same repeat flag. On the other hand it's also pointless because then your file has a lower real fps and you're not missing anything.
May i suggest interleave(last, last) if you find duplicates so attractive?
7ekno
26th August 2009, 11:59
May i suggest interleave(last, last) if you find duplicates so attractive?
But frames 0 and 1 are different, 1 and 2 are the same, as are 3 and 4, etc ;)
So while interleave(last,last) will duplicate the frames, it won't actually replicate the original stream ...
Sorry, thought the idea was to actually have a filter that adhered to new emerging standards (AVCHDlite) and be ahead of the game ;)
Won't go into the dynamics of LCD screens and "pixel hold times" relating to the human perception of "jerkiness" as a defense for the 50fps preference ;)
7ek
canTsTop
26th August 2009, 13:57
FFmpegSource is reporting 49,945 fps on my 25fps sample atk_sample_0.ts (Downlod here (http://www.mediafire.com/?sharekey=0d21c08fd364c52f61d4646c62b381cb6816bd8ecd1727af5621d66e282a0ee8))
Using this version: ffms2-r192-2.rar
Index with this command ffmsindex atk_sample_0.ts -t -1
avs script:
a=FFAudioSource("atk_sample_0.ts")
v=FFVideoSource("atk_sample_0.ts")
AudioDub(v,a)
And ffmsindex complaining that libiomp5md.dll is missing, had to download from internet
LoRd_MuldeR
26th August 2009, 13:58
But frames 0 and 1 are different, 1 and 2 are the same, as are 3 and 4, etc ;)
So while interleave(last,last) will duplicate the frames, it won't actually replicate the original stream ...
If 1 and 2 are the same, 3 and 4 are the same and so on, while 0 and 1 are different, 2 and 3 are different and so on, then your stream consists of pairs of identical (duplicated) frames.
That's exactly what interleave(last,last) would do, starting from a stream that contains no duplicates...
Myrsloik
26th August 2009, 15:58
But frames 0 and 1 are different, 1 and 2 are the same, as are 3 and 4, etc ;)
So while interleave(last,last) will duplicate the frames, it won't actually replicate the original stream ...
Sorry, thought the idea was to actually have a filter that adhered to new emerging standards (AVCHDlite) and be ahead of the game ;)
Won't go into the dynamics of LCD screens and "pixel hold times" relating to the human perception of "jerkiness" as a defense for the 50fps preference ;)
7ek
What is the standard exactly? I thought it was only a fancier name for avc in mp4 at moderately high resolutions. I'm also goign to dispute the whole concept of "original stream" because I do return every single frame. Of course this reply won't make you any happier but if you can find anything about the actual stream differences that would at least help me explain everything.
The missing runtime dll is caused by TheRyuu for some inexplicable reason compiling stuff with ICL even if it will have absolutely no performance difference in the end. I'll go blame him. I'll take a look at the sample you posted later today...
TheRyuu
26th August 2009, 22:53
What is the standard exactly? I thought it was only a fancier name for avc in mp4 at moderately high resolutions. I'm also goign to dispute the whole concept of "original stream" because I do return every single frame. Of course this reply won't make you any happier but if you can find anything about the actual stream differences that would at least help me explain everything.
The missing runtime dll is caused by TheRyuu for some inexplicable reason compiling stuff with ICL even if it will have absolutely no performance difference in the end. I'll go blame him. I'll take a look at the sample you posted later today...
Yes blame me. :)
http://ffmpegsource.googlecode.com/files/ffms2-r197.rar
Should fix your problem (same archive includes both ffmpeg-mt and regular ffmpeg builds now).
LoRd_MuldeR
26th August 2009, 23:03
What is the standard exactly? I thought it was only a fancier name for avc in mp4 at moderately high resolutions.
AVCHD is to H.264 what Video-DVD is to MPEG-2. Or in other words: AVCHD uses a subset of H.264. It puts additional restrictions on what resolutions, framerates and bitrates are allowed. Also it defines what audio formats can be used (AC-3 and L-PCM). And it defines the container level. But AFAIK the container used by AVCHD is not MP4 (ISO Media), but MPEG-2 Transport Stream.
diizzy
27th August 2009, 17:41
@ 7ekno
I have the same issue (I don't think mine really are 25i though). The clips are played back correctly in MPC-HC but reported as 25 fps in tsmuxer, MPC-HC and ffmpegSource.
Only eac3to detects it correctly but after muxing ffmpeg plays it back way too fast no matter what I do.
//Danne
Ghostlamer
29th August 2009, 19:28
Hello, when i use resizer = "BICUBIC" , avisynth tells "the named argument resizer to ffmpegsource2 has wrong type..
I use ffmpegsource svn r197.
My Script:
ffmpegsource2("C:\Users\Ghostlamer\Desktop\DBZ\TEMP\DBZ 182.mkv", vtrack = -1, atrack = -1, width = 470, height = 264, resizer = "BICUBIC", threads= 4)
TextSub("C:\Users\Ghostlamer\Desktop\DBZ\TEMP\DBZ 182_Track4.srt")
thewebchat
29th August 2009, 22:03
From FFMS2.avsi:
function FFmpegSource2(string source, int "vtrack", int "atrack", bool "cache", \
string "cachefile", int "fpsnum", int "fpsden", string "pp", int "threads", \
string "timecodes", int "seekmode", bool "overwrite", int "width", int "height", \
int "resizer", string "colorspace", int "rffmode", int "adjustdelay") {
Change that to string "resizer".
TheFluff
29th August 2009, 22:36
fixed in svn now, thanks for the report
Ghostlamer
30th August 2009, 08:17
From FFMS2.avsi:
Change that to string "resizer".
I change that and function FFImageSource(string source, int "width", int "height", int "resizer", string "colorspace"), now it tells FFAudioSource: Audio track contains no audio frames.
When i use (640x480,1024x768,1280x1024 resize) it loads with audio track, when i use like 720x480 it display that message..
Or when i use only video without audio, it loads with current resize to 470x264.
Updated:
I used SWScale function for resize and now its works with 470x264..
Is any differece between SWScale function resizing and resizing in first string ffmpegsource2(" width = , height = , resizer = "") ?
Myrsloik
30th August 2009, 13:04
I change that and , now it tells FFAudioSource: Audio track contains no audio frames.
When i use (640x480,1024x768,1280x1024 resize) it loads with audio track, when i use like 720x480 it display that message..
Or when i use only video without audio, it loads with current resize to 470x264.
Updated:
I used SWScale function for resize and now its works with 470x264..
Is any differece between SWScale function resizing and resizing in first string ffmpegsource2(" width = , height = , resizer = "") ?
Your problem makes absolutely on sense. There is no way the video can have any effect on the audio. Post the exact script you used and possibly a sample too.
Yes, there is a difference in certain cases.
1. If the clip has a different colorspace than what avisynth supports for output
2. If the clip has colorspace and resolution changes you can select what you want as output instead of using the settings of the first frame
canTsTop
31st August 2009, 19:19
FFmpegSource is reporting 49,945 fps on my 25fps sample atk_sample_0.ts (Downlod here (http://www.mediafire.com/?sharekey=0d21c08fd364c52f61d4646c62b381cb6816bd8ecd1727af5621d66e282a0ee8))
Using this version: ffms2-r192-2.rar
Index with this command ffmsindex atk_sample_0.ts -t -1
avs script:
a=FFAudioSource("atk_sample_0.ts")
v=FFVideoSource("atk_sample_0.ts")
AudioDub(v,a)
Any news about this? same problem with version ffms2-r197
Thank You
Myrsloik
31st August 2009, 22:31
Any news about this? same problem with version ffms2-r197
Thank You
That clip is so broken it hurts. This is plainly unsupported, do not expect a video file with ZERO keyframes to ever work well. It's a bad omen. Also all the other evidence suggests that the clip really is 50fps and nothing else.
SO I'M RIGHT AND YOU'RE WRONG! HA! Bet you didn't see that one coming.
Based on these observations:
In MPC the communistic propaganda clearly syncs up with the talking heads
In mplayer (the penguin propaganda tool, that is) it is incorrectly detected as 25 fps and that obviously desyncs very quickly
Playtime duration is identical between MPC and VDub at 50 fps, framestepping in MPC hints at the same
Setting rffmode=1 gives you 50 fps
Seeking is horribly broken anyway because there are no keyframes and probably something else that's bad with the stream
LISTS ARE AWESOME!
Can someone try my donation button? Tell me if it worked after you've sent me some money. That would be a big help.
canTsTop
1st September 2009, 20:28
Thank You for replay. DGAVCIndex, Avidemux 2.6 report 25.00 fps for that sample. If no keyframes is problem, here is another sample with keyframes with_idr.ts (http://www.mediafire.com/?nzzdmzjzmyy), ffms2-r197 reports it as 28.538 fps
Myrsloik
1st September 2009, 20:41
Thank You for replay. DGAVCIndex, Avidemux 2.6 report 25.00 fps for that sample. If no keyframes is problem, here is another sample with keyframes with_idr.ts (http://www.mediafire.com/?nzzdmzjzmyy), ffms2-r197 reports it as 28.538 fps
Did you use rffmode=1? It changes the framerate "calculation" too.
canTsTop
1st September 2009, 20:58
if i add rffmode=1 to avs, reported fps is 50 fps, and video duration ~46 seconds, playing to fast. in mpc video duration is 1min 22seconds
EDIT:
if i add AssumeFPS(25, sync_audio=false) at bottom of script, everything seems to be ok
a=FFAudioSource("with_idr.ts")
v=FFVideoSource("with_idr.ts",rffmode=1)
AudioDub(v,a)
AssumeFPS(25, sync_audio=false)
is this method is correct? will i lose video information?
TheFluff
1st September 2009, 23:24
rffmode=1 will never remove any frames; only add them (it can repeat fields if the stream flags tells it to). neither will assumefps(), since it only changes timestamps, not frames. so yeah, it should be safe to say that you will not lose any information. the question is if the result is what you actually want, though...
canTsTop
2nd September 2009, 11:58
If i add AssumeFPS(25, sync_audio=false) at bottom of script, video duration is 1min 32sec instead of 1min 22sec. If i play that script in mpc audio/video synchronization is good and video/audio stops after 1min 22sec, other 10 seconds is just silence and no video. But if i seek in mpc this script a/v synch is lost, and i can seek to 1min 30sec and see video.
vlada
4th September 2009, 10:50
Hi,
I have a problem with accented characters and FFmpegSource.
First problem is, that ffmsindex from CLI fails with file stored in path with accented characters. I tried to encode the command to cp895, cp852. cp1250, iso-8895-2 and utf-8. None of them worked. Most programs work with cp1250 encoding.
The same problem appears if I use accented characters with FFVideoSource in an .avs script. Again I tried all possible encodings and none of them worked. AVISource or DirectShowSource work in cp1250 encoded scripts.
Myrsloik
4th September 2009, 11:20
FFmpeg does not support unicode on windows. Avisynth does not support unicode anywhere. This is not the thread for you.
TheFluff
4th September 2009, 13:17
You can actually get unicode support from ffms2 on windows, but only if you use the C++ API directly, and only if you compile it against a patched FFmpeg (the patch is in /etc on the ffms2 svn trunk). It will not work through Avisynth. ffmsindex.exe does not support unicode commandlines at all; it only supports the system local encoding.
vlada
4th September 2009, 13:50
I know about the lack of unicode support. That's not what I'm asking for. But I would like to make it work with system encoding (which is cp1250 in my case). But as soon as I use any non ASCII characters (such as ě,š,č,ř,ž etc.), it will fail.
Myrsloik
4th September 2009, 18:24
I know about the lack of unicode support. That's not what I'm asking for. But I would like to make it work with system encoding (which is cp1250 in my case). But as soon as I use any non ASCII characters (such as ě,š,č,ř,ž etc.), it will fail.
The string from avisynth is passed unmodified to ffmpeg. Use short filenames if you really have to open weirdly named files or submit a patch. I may look at it again the day ffmpeg adds utf8 support (without patching) on windows because I'm too lazy to distribute modified sources.
Myrsloik
6th September 2009, 11:02
2.11 is now released. Read the changelog carefully.
Now 100% less beta
FFMSIndex can now write timecode files
Optimized index reading and writing, file opening should be faster especially for big files
Fixed a crash bug on zlib compressed streams in matroska
Added an argument to FFAudioSource that makes it automatically adjust the delay relative to the first video track (default), the specified track (any track type possible) or relative to the zero timestamp, no adjustment is done for files with no video track in the default mode
Now exports the colorimetry info in a format easily usable with ColorMatrix, see FFCOLOR_SPACE and FFCOLOR_RANGE in the manual, the reported information may be unreliable
Added an FFImageSource() function to ffms2.avsi which invokes FFVideoSource with the optimal settings for use on images
Now exports the actual frame presentation time in FFVFR_TIME, added the general information function FFInfo() and FFFormatTime() functions to ffms2.avsi in addition to fixing the missing backslash
The seek/read method has been changed in the matroska video source to only need the information in the index and nothing more, this matches the audio source and should make seeking faster in some cases
No longer drops the last audio frame
It is now possible to force indexing of broken tracks when using FFIndex and from the API, this can in many cases help when the last frame of an avi file is corrupted which would otherwise prevent indexing of all working data
Fixed a bug that would prevent the SWScale and FFPP filters from working because of randomly added flags
Added support for RFF flags, the three possible modes should be equivalent to the ones found in DGDecode
Added a workaround for mpeg4 files with NVOPs
Fixed a bug where the first frame would be corrupted if the colorspace/dimensions were set for the output
Now VC1 in TS decoding works in many cases
Added the missing install target to CMake and changed the default output library name (Kovensky)
Now reverts to using LAVF if Haali's splitter isn't installed (note that LAVF is VERY bad at seeking in these formats)
Now requires the boost headers (but not libraries) to compile because boost::format is so convenient
More API changes to return proper error codes and more source cleanups
Updated FFmpeg to rev 19776, FFmpeg-mt to 24/08/2009 - with faad2, opencore-amr nb/wb, and w32threads (pthreads for FFmpeg-mt)
vlada
6th September 2009, 20:24
The string from avisynth is passed unmodified to ffmpeg. Use short filenames if you really have to open weirdly named files or submit a patch. I may look at it again the day ffmpeg adds utf8 support (without patching) on windows because I'm too lazy to distribute modified sources.
Thanks for the idea to use short filenames. It seems to work perfectly so far.
And btw. many thanks for the new version of FFMS2.
dream-lx
7th September 2009, 19:52
Hi,
First of all thanks for ffmpegsource. It is really very usefull.
I used ffmpegsource in order to open xdcam MP4 files. Version 2.10 supported the files without any problem. 2.11 gives me the following error: out of bound track index selected. FFVideoSource seems to work. The problem seems to occur at the FFAudioSource statement. I have noticed that the same problem occurs for HDV m2t files. If you are interested to look into it please tell me what tests to do. If you would like to have the original file, please tell me and I will put in online for you.
Thanks in advance
Myrsloik
7th September 2009, 19:57
It's a known bug (I guess). Setting adjustdelay=-3 in FFAudioSource should fix it. I'll wait a few more days in case any other obvious problems are found and then release 2.12.
dream-lx
7th September 2009, 23:11
Hi,
I tried adjustdelay=-3 without success. However I have tried to call FFIndex(filename) before FFVideo(filename) and FFAudio(filename) and in this case it works pefectly for xdcam MP4 files. However also using this way, FFAudioSource is still not working for HDV m2t files. FFVideSource is working perfectly. For FFAudioSource the error message is now "Audio track contains no audio frames". The audio track contains mpeg-2 audio and is playable by ffplay. I have also tried the m2t files with the previous version. The previous version also didn't also handle them correctly.
Thanks in advance
Myrsloik
7th September 2009, 23:18
What are HDV m2t files? Can you provide one as a sample?
Atak_Snajpera
8th September 2009, 00:00
What are HDV m2t files?
created by HDV camcorders (Transport Stream <- Mpeg2 + mp2 Audio)
dream-lx
8th September 2009, 05:37
Hi,
While trying to prepare you an m2t file, I have discovered that some files works and others not. Unfortunately the nonworking files are 2gbytes long. I will try to reproduce the problem with smaller files during the next days and I will then report back. As a temporary work around, I found that ffmpeg -i error.m2t -vcodec copy -acodec copy good.m2t seems to solve the problem. The files having problems have been grabbed from tape using dvgrab under linux. The ones that don't have problems have been taken from a flash recorder from a Z7.
Myrsloik
8th September 2009, 16:22
You can binary cut transport streams so just cut the first 20MB or so of a non-working file. Check so it's still not working in the same way and put it somewhere.
dream-lx
8th September 2009, 16:46
I have thought at exactly the same thing, but if I binary cut the first 8 megabytes, everything works flawlessly so I think there is something in the middle confusing it. I will start tests now and report back soon.
dream-lx
8th September 2009, 17:36
I think there is something wired going on in dvgrab/ffmpeg as with other m2t files grabbed by dvgrab, I have other problems like: video steem not seekable. If I start to read the tape 1 sec later, everything works fine. I have tested in linux in kdenlive and the same clips having problem with ffmpegsource also seem to have problems in kdenlive. I think I will first make a bugreport for dvgrab not that we are trying to resolve a bug that isn't in ffmpegsource.
Myrsloik
8th September 2009, 22:12
Did you install Haali's splitter? If not you should really do so and delete all .ffindex files.
Blue_MiSfit
9th September 2009, 08:47
Thanks so much for all your efforts, Myrsloik (and others involved)!!
This is a truly wonderful swiss army knife of a source filter! I use it all the freaking time, and it's wonderfully stable and DirectShit free :D
~MiSfit
Myrsloik
11th September 2009, 23:17
2.12 - mixed bug fixes and one small feature
Added support for (L)PCM in TS/PS
Fixed some possible memory corruption on initialization in the indexers
Improved the API slightly by making resolution and colorspace frame properties only like they actually are
Fixed adjustdelay=-1 when no video track is present, previously it would crash
Updated FFmpeg to rev 19824, FFmpeg-mt unchanged at 24/08/2009 - with faad2, opencore-amr nb/wb, and pthreads
I guess this should be considered quite stable. Maybe...
thewebchat
12th September 2009, 00:27
timecodes output produces some strange results when used on VOBs like the one in this post (http://forum.doom9.org/showpost.php?p=1324089&postcount=16). Some frames have durations of 0 in the output timecodes like this:
# timecode format v2
0.000000
66.733333
66.733333
133.466666
166.833333
166.833333
Is this expected?
Myrsloik
12th September 2009, 01:53
It's known and expected, kinda. Haali's parser tries to interpolate times but isn't that good at it. But VOB/TS rarely (never) are VFR anyway so it isn't really a problem. Or are you doing something weird?
thewebchat
12th September 2009, 02:21
Well, I know of several DVDs that are encoded with mainly 24p/RFF and some 30p/60i sections. I figured that, since parts that are already progressive shouldn't be ivtc'd, I would use the timecodes output to search for the non-film sections. Now, I know that I could just set rffmode=1 and do it the old way, but I figured, since FFMS2 is a new and advanced software, I could use hybrid operation on VOBs.
Myrsloik
12th September 2009, 10:40
IF you want to do something like that I'd suggest that you also make a d2v for the same file. Then write a small program to generate a proper set of timecodes from that. I guess I should add fake d2v generation/some other way to export the rff stuff (already on the todo list).
saint-francis
13th September 2009, 15:43
This (http://www.mediafire.com/?sharekey=1f010a972ed14ad0d956df2962098fcb6c140e682a9e54115621d66e282a0ee8)file fails with ffvideosource. All kinds of artifacts.
Sorry, I couldn't get it to load in tsremux for the desired method of cutting.
Myrsloik
13th September 2009, 23:58
This (http://www.mediafire.com/?sharekey=1f010a972ed14ad0d956df2962098fcb6c140e682a9e54115621d66e282a0ee8)file fails with ffvideosource. All kinds of artifacts.
Sorry, I couldn't get it to load in tsremux for the desired method of cutting.
No extension and adding .ts doesn't seem to make mpc any happier...
Despite this setback of grand proportions I will still try to diagnose your problem. I think your problem is that you didn't read the list of known issues.
henryho_hk
19th September 2009, 12:32
When we rip a DVD on file basis, we will get a number of (actually splitted) files like VTS_01_1.VOB, VTS_01_2.VOB, VTS_01_3.VOB .... Can I tell ffindex(), ffvideosource(), etc to open them as a whole?
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.