Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th June 2007, 21:12   #1  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,869
FFmpegSource

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 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

Latest binaries

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:
Code:
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()
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet

Last edited by Myrsloik; 7th January 2017 at 22:17. Reason: Update links
Myrsloik is offline   Reply With Quote
Old 16th June 2007, 21:40   #2  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,310
That's cool stuff! I will try it out tomorrow!
Wilbert is offline   Reply With Quote
Old 17th June 2007, 01:37   #3  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,380
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
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. ~ Ed Howdershelt
foxyshadis is offline   Reply With Quote
Old 17th June 2007, 11:18   #4  |  Link
Alain2
Registered User
 
Join Date: May 2005
Posts: 236
This plugin sounds interesting

As a matter of interest, is it handling variable framerate video and how ? (something similar to directShowSource(convertfps=true,fps=...) ?)
Alain2 is offline   Reply With Quote
Old 17th June 2007, 12:14   #5  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,869
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.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 17th June 2007, 14:49   #6  |  Link
Kurtnoise
Swallowed in the Sea
 
Kurtnoise's Avatar
 
Join Date: Oct 2002
Location: Aix-en-Provence, France
Posts: 5,183
edit...wrong manip.

Last edited by Kurtnoise; 17th June 2007 at 14:52.
Kurtnoise is offline   Reply With Quote
Old 17th June 2007, 14:51   #7  |  Link
Kurtnoise
Swallowed in the Sea
 
Kurtnoise's Avatar
 
Join Date: Oct 2002
Location: Aix-en-Provence, France
Posts: 5,183
Quote:
Originally Posted by Myrsloik View Post
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 ?
Kurtnoise is offline   Reply With Quote
Old 17th June 2007, 17:38   #8  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,869
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.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 19th June 2007, 07:27   #9  |  Link
Kurtnoise
Swallowed in the Sea
 
Kurtnoise's Avatar
 
Join Date: Oct 2002
Location: Aix-en-Provence, France
Posts: 5,183
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 :

Code:
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.
Kurtnoise is offline   Reply With Quote
Old 19th June 2007, 10:02   #10  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,406
Quote:
Originally Posted by Kurtnoise13 View Post
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?
tebasuna51 is offline   Reply With Quote
Old 19th June 2007, 23:27   #11  |  Link
tranfa
Registered User
 
Join Date: Oct 2006
Posts: 68
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?
tranfa is offline   Reply With Quote
Old 19th June 2007, 23:48   #12  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,380
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.)
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. ~ Ed Howdershelt
foxyshadis is offline   Reply With Quote
Old 20th June 2007, 06:55   #13  |  Link
AVIL
Registered User
 
Join Date: Nov 2004
Location: Spain
Posts: 401
@tranfa

If you use Virtualdub to render the scripts, you can put the support dll's into Virtualdub's folder.
AVIL is offline   Reply With Quote
Old 20th June 2007, 20:14   #14  |  Link
tranfa
Registered User
 
Join Date: Oct 2006
Posts: 68
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.
tranfa is offline   Reply With Quote
Old 20th June 2007, 21:34   #15  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
I am a little confused by this comment:

Quote:
Originally Posted by foxyshadis View Post
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?
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 20th June 2007, 23:10   #16  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,869
They're completely standard. The included dlls were compiled with:

Code:
./configure --enable-shared --disable-static --enable-memalign-hack --enable-swscaler --enable-gpl --disable-encoders --disable-muxers
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 21st June 2007, 06:59   #17  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,380
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. >.>
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. ~ Ed Howdershelt
foxyshadis is offline   Reply With Quote
Old 21st June 2007, 07:21   #18  |  Link
d'Oursse
Mushroomeur
 
Join Date: Jun 2003
Location: Mushrooms of Paris Town
Posts: 267
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.
d'Oursse is offline   Reply With Quote
Old 21st June 2007, 14:44   #19  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,869
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/~boehm...ec_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...
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 21st June 2007, 14:59   #20  |  Link
d'Oursse
Mushroomeur
 
Join Date: Jun 2003
Location: Mushrooms of Paris Town
Posts: 267
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.
d'Oursse is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:18.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.