View Full Version : FFmpegSource
Myrsloik
16th June 2007, 21:12
TRIGGER WARNING
The posts contained in this thread may be very upsetting for users of old operating systems, old cpus and stupid people
-------------------------------------------------------
This thread shall begin much like one of my previous (http://forum.doom9.org/showthread.php?t=98327) ones...
One day I got bored (again) and thought it would nice to have a plugin to open mkvs and similar things. That attempt failed miserably because it turns out that ffmpeg has just as much documentation as the average open source project.
But as you all know you can't let computers win. Ever.
This plugin should support decoding of all FFmpeg supported video formats with frame accurate seeking in avi, mkv and mp4 and possibly some others. Haali's parser is used for matroska since the ffmpeg one has serious issues and FFmpeg for everything else. Opening files is however a bit slow due to the required indexing.
Github project (https://github.com/FFMS/ffms2)
Latest binaries (https://github.com/FFMS/ffms2/releases)
Note: The real name is "Fabulous FM Source 2" and is in no way related to FFmpeg.
How to use as an image source in VapourSynth:
import vapoursynth as vs
first_image = 4
num_images = 160
filename_pattern = 'D:/imgseq/output_{0:05d}.jpg'
c = vs.get_core()
placeholder_clip = c.std.BlankClip(clip=c.ffms2.Source(filename_pattern.format(first_image), cache=False), length=num_images)
def image_loader(n):
return c.ffms2.Source(filename_pattern.format(n + first_image), cache=False)[0]
clip = c.std.FrameEval(placeholder_clip, image_loader)
clip.set_output()
Wilbert
16th June 2007, 21:40
That's cool stuff! I will try it out tomorrow!
foxyshadis
17th June 2007, 01:37
Very awesome. I might be able to skip DirectShowSource entirely now.
Seeking is broken on MPEG1 PS files, and when muxed into another container they just don't work at all. Well, I can continue using DGDecode on those. All other formats appear to work perfectly.
One concern I have is the naming of the support files. Obviously they can't be statically linked, being different compilers, but other software uses the same libs, but incompatible. (Mediacoder for one, probably others.) Would it be possible to add a prefix/suffix to them? Even better, use loadlibrary to load them from the plugin's folder (which is rarely the same as current working folder in avisynth)?
The listed improvements would be awesome, particularly timecodes. =D
Alain2
17th June 2007, 11:18
This plugin sounds interesting :)
As a matter of interest, is it handling variable framerate video and how ? (something similar to directShowSource(convertfps=true,fps=...) ?)
Myrsloik
17th June 2007, 12:14
Actually I'm considering making it a c interface plugin because then I could statically link everything with gcc.
With vfr it just returns every encoded frame and sets the fps to 30.
Kurtnoise
17th June 2007, 14:49
edit...wrong manip.
Kurtnoise
17th June 2007, 14:51
With vfr it just returns every encoded frame and sets the fps to 30.
Actually, it returns 30 fps even with my 25 fps raw materials (at least for me). What's wrong ?
Myrsloik
17th June 2007, 17:38
That should be fixed in the updated version. It used the duration from another unrelated place before which for some reason also was 30 fps.
Kurtnoise
19th June 2007, 07:27
Thanks for the new build.
btw, I've a request for the next releases : to be able to choose/select the video *or* audio tracks numbers.
Something like that :
FFmpegSource(string source, int vtrack = -1, int atrack = -1, bool forceseek = false, string timecodes)
where vtrack stands for video tracks and atrack for audio tracks of course.
tebasuna51
19th June 2007, 10:02
Thanks for the new build.
btw, I've a request for the next releases : to be able to choose/select the video *or* audio tracks numbers.
I'm also interested in ffmpeg like audio decoder, actually I can't get audio from FFmpegSource().
Maybe in a future release?
tranfa
19th June 2007, 23:27
Hi Myrsloik,
unfortunately I get a "Loadplugin: unable to load C:\Program files\AviSynth 2.5\plugins\FfmpegSource.dll" error....but apparently everything should be in order (plugins in the right place).
Do you have an idea on what I'm doing wrong?
foxyshadis
19th June 2007, 23:48
All of the support dlls have to be on the path, not in the same folder as the plugin. The simplest path is just putting them in the windows folder. (Or you can add the plugin folder to the windows path in the system control panel, but that might not be a great idea.)
AVIL
20th June 2007, 06:55
@tranfa
If you use Virtualdub to render the scripts, you can put the support dll's into Virtualdub's folder.
tranfa
20th June 2007, 20:14
Thank you foxyshadis, thank you AVIL: I put the dlls into windows/system32 directory, and everything works fine both with Avsp and Vdub.
By the way, thank you Myrsloik, great plugin.
Fizick
20th June 2007, 21:34
I am a little confused by this comment:
One concern I have is the naming of the support files. Obviously they can't be statically linked, being different compilers, but other software uses the same libs, but incompatible. (Mediacoder for one, probably others.)
Myrsloik do you complile this "support DLL" some special way or they are standard?
Myrsloik
20th June 2007, 23:10
They're completely standard. The included dlls were compiled with:
./configure --enable-shared --disable-static --enable-memalign-hack --enable-swscaler --enable-gpl --disable-encoders --disable-muxers
foxyshadis
21st June 2007, 06:59
It's the configure options that are different. Mediacoder uses a totally different set, since it enables encoders and muxers.
Actually, now that I went hunting, I can't figure out what's dependant on that older avformat-51.dll. I guess it's not that important, in that case. >.>
d'Oursse
21st June 2007, 07:21
Kurosu tried to write an ffmpeg source for avs3. He had a lot of problems with the audio. I can't remember what was the difficulty, though.
One thing to note about ffmpeg: the dev team never does any release and the api can change one day or another. So the plugin can, one day, not work anymore.
Myrsloik
21st June 2007, 14:44
I've looked a bit at the audio part now and everything seems to be the difficult part (unless you just want to play it linearly from one not too accurately specified point, then it's trivial).
The part about ffmpeg developers possibly changing the api one day is an exceptionally weak point if you look at how much has actually changed over the years. The sample I started with (unfortunately the only decent one in existence) from http://www.inb.uni-luebeck.de/~boehme/libavcodec_update.html which was written exactly 3 years ago can still be compiled by only changing 3 lines or so (and by adding a few explicit casts if you use a c++ compiler). The changes were only in the names of fields containing information about the streams and the replacements were easy to locate. There were no changes in the actual decoding logic and the library still contains all deprecated functions so older programs should work with the new version after a recompile. You might as well say that one day windows will change and avisynth won't work anymore...
What official releases have to do with it will remain a mystery...
d'Oursse
21st June 2007, 14:59
ask the gstreamer developpers about the different versions of ffmpeg. For a developper it's a pain. Example : 3 or 4 days ago : they changed the options of configure. It's not 3 years at all.
The interest of a release : When compiling a program, you can check a specific version of the release. Then you know what the api is and use the correct functions, struct, etc... You might also know with a release if the abi is broken from a version to another, or not, which is also very important.
windows has already changed and some programs didn't work anymore. Even with different SP of XP some programs work or not.
akupenguin
21st June 2007, 20:01
ask the gstreamer developpers about the different versions of ffmpeg. For a developper it's a pain. Example : 3 or 4 days ago : they changed the options of configure. It's not 3 years at all.
That's the build system, not the api. It affects compiling ffmpeg, not compiling programs which use libav*, unless you imported a copy of ffmpeg into your source tree.
Incompatible api changes require incrementing the major version, which has happened twice in the last 3 years.
Myrsloik
22nd June 2007, 17:50
My attempt at a sample accurate audio source. Not very tested yet. Only supports mpeg1 layer 2/3 audio in mkv so far. Should seek accurately in the same formats as the video source.
Usage: FFAudioSource(string source, int track = -1)
Experimental audio source (http://ivtc.org/new/beta/FFAudioSource.dll)
ficofico
23rd June 2007, 11:06
I've tried to make a script including this line
(mvfpsflowscd(30,oversample=16,blurradius=4)
but when I open the file with FFMpegSource avisynth give me an error
http://ficofico.interfree.it/errore.JPG
Where I've to write "linear=false" ?
IanB
23rd June 2007, 13:37
ChangeFPS(...., linear=False)And it will be on line 10 of one of your *.AVSI files.
Also oversample=8 might probably avoid the issue as well.
Mr_Odwin
28th June 2007, 21:37
What there is of this so far is great. I used it today on an flv file and the video part seemed to work fine, even though flv isn't mentioned in the readme.
Myrsloik
2nd July 2007, 22:47
A new version has been released with several improvements to seeking.
FLV files have now been confirmed to work perfectly
VOB files now appear to have frame accurate seeking (at least with the single test vob used) but no rff flags applied (won't ever happen)
Normal MPG files should seek without showing artifacts
Feel free to report the results with any other containers you use.
VOB files now appear to have frame accurate seeking (at least with the single test vob used) but no rff flags applied (won't ever happen)
Wouldn't applying rff flags be a must for proper IVTCing of badly flagged video? (Looking at that URL in your sig I'm rather surprised to read the above... :))
np: Lusine - Flat (Cepia Remix) (Podgelism)
Myrsloik
2nd July 2007, 23:04
Doing that using only libraries coming from ffmpeg you have to first decode the video to find out the flags. So in the end all you'd get is a very slow dgindex/dgdecode clone if you're lucky. I don't see a great demand for that.
If you find me a nice mpeg/vob/ts parsing library it would be a completely different thing though...
infernix
4th July 2007, 22:25
works on wine! tried only on demuxed .vc1 source so far:
FFmpegSource(source="FEATURE_1_FEATURE_2.VC-1.stream.0.vc1",track=-1,seekmode=0,timecodes="test.timecodes",cache=true,cachefile="test.ffcache")
AssumeFPS(23.976)
takes a minute or two to index for 18GB. And I can't seek, or it takes incredibly long (probably the latter).
Thanks so much :) i hate the VFW interface, I couldn't get it to read vc1 :)
Myrsloik
13th July 2007, 06:18
Version 1.3 has been released (see first post) and some other items have been added to the possible improvements list.
ficofico
13th July 2007, 16:21
Myrsloik can you post the version 1.1? This version doesn't work in my batch script.
With the tool avs2avi, the avs file is like: ffmpegsource("temp.mp4) when temp.mp4 it's a x264 8000 bitrate .The conversion in xvid with avs2avi with the 1.1 release it's good, with this version doen't work, it give me error.
The dll in plugins directory it's still 1.1 (after I've seen that 1.3 doesn't work) but the dll in system32 are from 1.3 version.
thanks
Myrsloik
13th July 2007, 18:02
No, if you can't be bothered to actually tell me what the error is it can't be that important.
ficofico
13th July 2007, 18:51
the error it's
http://ficofico.interfree.it/errore1.jpg
the script it's very simple
http://ficofico.interfree.it/errore2.jpg
Before upgrade ffmpeg works well.
Harukalover
13th July 2007, 19:47
ficofico: Hint: Read the manual when upgrading to newer versions.
There is no function named ffmpegsource anymore.
/me points to ffvideosource
ficofico
13th July 2007, 20:07
ops..................sorry, but I've assume that the name was a constant.
Myrsloik
13th July 2007, 20:07
My guess is that you're using the ffmpeg dlls from a previous version/other program.
ficofico
13th July 2007, 20:47
no no, now I've upgrade the dll and change the script, now work. Thank you and sorry for the mistake.
Myrsloik
16th July 2007, 14:29
It's time to get some input from the silent masses...
What should I do about audio handling in general?
Is there any reason at all to keep FFAudioSource when FFAudioRefSource actually works (if you've got the space)?
Should FFAudioRefSource be merged with FFVideoSource (faster file opening the first time if you want both audio and video)?
Should I waste many more hours to try to get FFAudioSource to work (it's highly unlikely it'll ever be good for more than previews)?
...the next version will also have postprocessing.
Mr_Odwin
16th July 2007, 16:20
I personally would like FFVideo and FFAudio/FFAudioRef merged; perhaps like QTInput/Directshowsource where there is an audio=true/false option?
IanB
17th July 2007, 00:17
From a user perspective it is much more straight forward to them if you do the AudioDub of the audio and video internally for them.
From a programming perspective I know it sucks having function arguments left, right and centre to control need behaviour.
buzzqw
17th July 2007, 16:42
excellent :thanks: !
i have just build a beta of automkv that use yout ffmpegsource!
Excellent! now many users will be able to decode/process several kind of media (expecially when directshow source isn't so affidable)
just to know: is it a bug or know that framerate is always 30 ?
and ... using with autocrop plugin (that make arbitrary seek on file) will cause ffmpegsource to throw out an error (on mkv files)
thanks again, i would like to include your works in next release of AutoMKV, if you want
thanks!
BHH
Myrsloik
18th July 2007, 14:26
Yet another new version with big changes and probably some new bugs has been released...
The autocrop bug should be fixed and the framerate set to the average for mkv files.
Would there be any interest in a simple swscaler filter? It would allow combined resizing and colorspace conversions with some combinations possible that aren't available in avisynth by default (ever wanted to point resize the chroma when going between yuy2 and yv12?)
buzzqw
18th July 2007, 17:10
YES!
Autocrop is working, slow but working! THANKS!
and even the framerate is fixed!
Would there be any interest in a simple swscaler filter?
a resizer ?
imho ... no
i use your excellent plugin primary for loading file
then i use all avisynth internals/externals plugin for every other need
BUT i don't know so well avisynth so i cannot say if would be useful for some others..
one more think: one user have reported that after 50' and 14 sec the encoding is blocked.
It was feeding a 1280/640 x264+acc matroska file, using FFmpegSource 1.3
i haven't much more information, i will ask on my automkv thread
thanks again!
BHH
AVIL
20th July 2007, 11:28
Hi,
About this:
Future improvements if there's any interest:
Convert it to a c plugin (static linking, no additional dlls)
IMHO is preferable let things as is. Reason: the uderlying dll's could evolve even though the plugin remains unchanged or be discontinued.
Myrsloik
20th July 2007, 11:43
The source is available and without changes the binary is almost guaranteed to turn obsolete and unupgradable long before the source is with just a recompile.
MatMaul
21st July 2007, 18:58
I can't decode ac3 audio stream embedded in avi file, is it normal ? ("codec not found")
I think you haven't compile ffmpeg dlls with liba52 support.
Myrsloik
21st July 2007, 19:00
Did I ever claim to have compiled ffmpeg with any additional libraries?
buzzqw
21st July 2007, 19:03
well .. more library are inside.. more compatibility we have..
so i suggest to add additional library... if possible
thanks!
BHH
MatMaul
21st July 2007, 21:51
I suggest liba52 and libfaad2 then we can decode ac3 and aac streams which are very common.
tebasuna51
22nd July 2007, 00:00
At least with libfaad2 because don't exist a good dedicated aac decoder for AviSynth, actually we need use DirectShowSource.
For ac3 (and mpa, mp2, mp3) we can use NicAudio.dll also based in liba52.
For WAVE_FORMAT_EXTENSIBLE, ogg, flac, wma, ... we can use BassAudio.dll and Bass libraries + Add-Ons. BassAudioSource can decode stereo aac/mp4 but don't work for multichannel aac.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.