Log in

View Full Version : FFmpegSource


Pages : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 [56] 57 58 59 60

Rob105
27th May 2023, 19:58
Reading documentation for Avisynth+ (https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/faq/faq_loading_clips.html#how-do-i-load-mp4-mkv-m2ts-evo-into-avisynth) i found that to open MP4 need to use function FFmpegSource()

Which is missing in plugin v2.40, spent like hour troubleshooting this before i found this solution (https://forum.videohelp.com/threads/326930-ffmpegsource2-error-in-Avisynth#post2024539). :mad:

Wish you have provided proper ffms2.avsi that included this function with your plugin v2.40.

qyot27
27th May 2023, 20:46
Reading documentation for Avisynth+ (https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/faq/faq_loading_clips.html#how-do-i-load-mp4-mkv-m2ts-evo-into-avisynth) i found that to open MP4 need to use function FFmpegSource()

Which is missing in plugin v2.40, spent like hour troubleshooting this before i found this solution (https://forum.videohelp.com/threads/326930-ffmpegsource2-error-in-Avisynth#post2024539). :mad:

Wish you have provided proper ffms2.avsi that included this function with your plugin v2.40.
Uh, no. You're missing a 2. FFmpegSource2. Which has been included in the C++ plugin for years at this point.

That FAQ entry is referring to the old 1.x version of FFmpegSource, which is well over ten years out of date.

kedautinh12
14th June 2023, 03:51
When L-SMASH-Works and DGDecNV have Fixed _FieldBased, i thinh we can wait until FFMS2 have that fixed :D

tormento
14th June 2023, 13:43
When L-SMASH-Works and DGDecNV have Fixed _FieldBased
Yesterday DGDecNV slipstream fixed _FieldBased.

flossy_cake
22nd June 2023, 07:44
ffms2_ad42af1 (https://ppp.woelkli.com/s/Zntfn8yMSdJDJn7) (pass: dhNsmKt69th1):
- ffms2@1031029;
- ffmpeg@4113445;
- dav1d 1.1.0.

Thanks for this, but rffmode=1 is not working in this new version - the video freezes and black screen.

Also if rffmode=1 is fixed, please can you make it set the field order per-frame, since many NTSC DVDs have dynamic field order and even Bob() will not work on them because Avisynth will display frames in wrong order because FFMS2 is not telling Avisynth the field order of the source clip.

Test clip: https://rationalqm.us/misc/lainvob.vob

Test script:

FFMS2(clip, atrack=-1, rffmode=1)

ScriptClip(last,
\ """

fieldbased = propGetAny("_FieldBased")
parity = GetParity(current_frame)

if (!IsInt(fieldbased)){fieldbased = "undefined"}
else if (fieldbased==0){fieldbased = "progressive"}
else if (fieldbased==1){fieldbased = "bottom field first"}
else if (fieldbased==2){fieldbased = "top field first"}

if (!IsBool(parity)){parity="undefined"}
else if (parity==true){parity = "top field first"}
else if (parity==false){parity = "bottom field first"}

Text( "_FieldBased: " + fieldbased + "\n" + "GetParity: " + parity + "\n", lsp=0)

\ """)



To summarise:


FFMS2 support for rffmode=1 is completely nonfunctional
FFMS2 rffmode=1 needs to set the field order so that avisynth knows the field order of each frame


:thanks:

StvG
7th July 2023, 06:59
ffms2_r1363 (https://ppp.woelkli.com/s/H4kXCaZczp6cksc) (pass: BLxmx6YsVJ03):
- AviSynth: both GetParity and _FieldBased now can be changed per frame.
- ffms2@cf7c4b2;
- ffmpeg@4b1969;
- zlib 1.2.13;
- dav1d 1.2.1;
- libxml2 v2.11.4.

kedautinh12
7th July 2023, 09:39
Wow, sound good :D

FranceBB
7th July 2023, 10:27
Thank you for the new build!
So far so good. :)

tebasuna51
8th July 2023, 13:10
Please support AviSynth+ r4001 (https://forum.doom9.org/showthread.php?p=1989323#post1989323) including the audio channel mask.

rgr
29th August 2023, 12:24
Is it a known issue that ffms2 doesn't respect "Delay relative to video : -200ms"?

StvG
22nd September 2023, 18:27
ffms2_r1369 (https://ppp.woelkli.com/s/H4kXCaZczp6cksc) (pass: BLxmx6YsVJ03):
- AviSynth: fixed GetParity (rffmode > 0) and _FieldBased. (bugs introduced in the previous version)
- AviSynth: added support for audio channel mask.
- AviSynth: fixed fps (rffmode > 0). (bug introduced by the new FFmpeg API from the beginning of 2023)
- ffms2@cf7c4b2;
- ffmpeg@9310ff;
- zlib 1.3;
- dav1d 1.2.1;
- libxml2 v2.11.5.

Is it a known issue that ffms2 doesn't respect "Delay relative to video : -200ms"?

Does ffmpeg respect it by default?

tebasuna51
23rd September 2023, 10:15
ffms2_r1369 (https://ppp.woelkli.com/s/H4kXCaZczp6cksc) (pass: BLxmx6YsVJ03):
...
- AviSynth: added support for audio channel mask.
...

Thanks, to obtain the audio channel mask with last avs+ we need before:

global OPT_UseWaveExtensible = true # Needed to use global OPT_dwChannelMask=
audio=FFAudioSource("8w3D.ec3")
global OPT_dwChannelMask=FFCHANNEL_LAYOUT

Now is enough:

audio=FFAudioSource("8w3D.ec3")

to obtain the channel mask if is included in the source.

FranceBB
28th September 2023, 11:01
- AviSynth: fixed GetParity (rffmode > 0) and _FieldBased. (bugs introduced in the previous version)
- AviSynth: added support for audio channel mask.
- AviSynth: fixed fps (rffmode > 0). (bug introduced by the new FFmpeg API from the beginning of 2023)

Thank you for fixing those and most importantly for supporting audio channel masks.
Tebasuna and I are probably the only two people excited for it, but still, thank you! XD

kedautinh12
28th September 2023, 11:45
Me too :D

Myrsloik
28th September 2023, 12:52
ffms2_r1369 (https://ppp.woelkli.com/s/H4kXCaZczp6cksc) (pass: BLxmx6YsVJ03):
- AviSynth: fixed GetParity (rffmode > 0) and _FieldBased. (bugs introduced in the previous version)
- AviSynth: added support for audio channel mask.
- AviSynth: fixed fps (rffmode > 0). (bug introduced by the new FFmpeg API from the beginning of 2023)
- ffms2@cf7c4b2;
- ffmpeg@9310ff;
- zlib 1.3;
- dav1d 1.2.1;
- libxml2 v2.11.5.

Does ffmpeg respect it by default?

Is the current patch set available somewhere?

tebasuna51
29th September 2023, 09:40
Is the current patch set available somewhere?

It is included in the download.

Of course you need also the last avisynth.h (https://github.com/AviSynth/AviSynthPlus/blob/master/avs_core/include/avisynth.h)

Myrsloik
29th September 2023, 09:53
It is included in the download.

Oh, only as a single monolithic mess with no comments as to why certain parts are relevant? That's a lot less helpful.

I did however see that getparity is implemented for avisynth. Does anything actually use that?

kedautinh12
29th September 2023, 09:59
Oh, only as a single monolithic mess with no comments as to why certain parts are relevant? That's a lot less helpful.

I did however see that getparity is implemented for avisynth. Does anything actually use that?

I think avisynth more helpful than vapoursynth thread of doom9 :D

StvG
22nd October 2023, 03:28
Just a heads up that from this version (https://forum.doom9.org/showthread.php?p=1986154#post1986154) there is a regression about the handling of the unicode filenames.

If you have issues about unicode filenames complain to the used app for reading/opening the avs script that doesn't support unicode filenames or just active the Unicode UTF-8 support in Windows (if available).

Starting from this post (https://forum.doom9.org/showthread.php?p=1992697#post1992697) you can read about AvsPmod.

I'll upload the code used for my builds to codeberg and then post a new version.

StvG
22nd October 2023, 09:13
Seeking test with ffms2_r1369 (https://forum.doom9.org/showthread.php?p=1991852#post1991852) and ffms2 build from f20827c (https://github.com/FFMS/ffms2) (both using the same versions of the external libraries). The used video files (https://drive.google.com/file/d/1-95lSEnxu3aGZS3WqwJPaYHSk4M7GSr9/view?usp=share_link).

https://thumbs2.imgbox.com/70/4c/WbhGLirM_t.png (https://imgbox.com/WbhGLirM)

FranceBB
22nd October 2023, 09:52
In other words, from the chart and the test assets, there's no scenario in which someone should be using the legacy Myrsloik 2020 version given that the new version 2023 builds you keep producing addressed plenty of the issues it had.
Once again, thank you for keeping the project alive, in fact your builds have now become the standard included in FFAStrans and also the one my colleagues and I use at work on a daily basis :)

StvG
22nd October 2023, 10:23
Also you probably noticed that there are files with same names but different containers. I remuxed the files from ts,mts,mpg,mp4... to mkv. Other than VC-1 the other codecs are ok when mkv is used.

FranceBB
4th November 2023, 20:51
Ok, so, after some rather extensive testing and after wondering "why?" many times, I actually realized one thing: FFMpeg's mxf muxer for MJPEG2000 RGB48 HDR PQ files is now completely broken.
It already had its own issues (https://trac.ffmpeg.org/ticket/10001) a year ago with the wrong bit depth being written in the container and the CDCI essence descriptor UL (i.e YUV 4:4:4) being used instead of the RGBA essence descriptor UL (i.e RGB48), but now it got worse.
You now may be wondering: "Well, that's an ffmpeg problem, what does it have to do with FFVideoSource()"?
Well, simply enough, now the video in the mxf container remuxed by ffmpeg is so broken that FFVideoSource() - albeit indexing it - shows repeated/duplicated frames all over the place while dropping some other frames (I tested both ffms2 version r1347 from January 2023 and version r1369 from September 2023) and they both have issues. I even tried different seeking modes like forcing linear, specifying fpsnum=24000 and fpsden=1001 etc but nothing really helped.
Please note that this is not necessarily a problem of ffms2, but rather FFMpeg muxing the file blatantly incorrectly in the mxf container.
On the other hand, muxing the very same file in the mkv container has no issues at all and in fact both versions of ffms2 index it just fine and without any repeated/duplicated frames, correctly reporting 23,976p.

So, this post is to warn everyone and avoid having other people spending hours in debugging:
if anyone has to deal with MJPEG2000 files in mxf muxed by FFMpeg, please remux them in mkv and they'll work like a charm.


For reference, here's the original mxf file:


General
Complete name : Test.mxf
File size : 295 GiB
Duration : 57 min 30 s
Overall bit rate : 734 Mb/s
Frame rate : 23.976 FPS

Video
ID : 2-2
Format : JPEG 2000
Format profile : IMFS4k@ML6SL4
HDR format : SMPTE ST 2086, HDR10 compatible
Muxing mode : MXF
Codec ID : 0D010301020C0600-0401020203010313
Duration : 57 min 30 s
Bit rate : 716 Mb/s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 (24000/1001) FPS
Color space : RGB
Bit depth : 12 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 3.600
Stream size : 288 GiB (97%)
Title : Image Track
Color range : Full
Color primaries : BT.2020
Transfer characteristics : PQ
Matrix coefficients : BT.2020 non-constant
Mastering display color primaries : Display P3
Mastering display luminance : min: 0.0050 cd/m2, max: 1000 cd/m2


and here's what happens after remuxing it with ffmpeg's mxf muxer:



General
Complete name : Test.mxf
Format : MXF
Format version : 1.3
Format profile : OP-1a
Format settings : Closed / Complete
File size : 295 GiB
Duration : 57 min 30 s
Overall bit rate : 734 Mb/s
Frame rate : 23.976 FPS
Package name : File Package: SMPTE ST 422 / ST 2067-5 frame wrapping of JPEG 2000 codestreams
Writing application : FFmpeg OP1a Muxer
Writing library : Lavf (mingw32)

Video
ID : 2
Format : JPEG 2000
Format profile : IMFS4k@ML6SL4
HDR format : SMPTE ST 2086, HDR10 compatible
Format settings, wrapping mode : Frame
Codec ID : 0D010301020C0100-0401020203010100
Duration : 57 min 30 s
Bit rate : 716 Mb/s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:4:4
Bit depth : 16 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 3.600
Stream size : 288 GiB (97%)
Color primaries : BT.2020
Transfer characteristics : PQ
Matrix coefficients : BT.2020 non-constant
Mastering display color primaries : Display P3
Mastering display luminance : min: 0.0050 cd/m2, max: 1000 cd/m2
Delay_SDTI : 3573570



In other words the container is lying as it's saying that it's a 4:4:4 16bit file, while it's actually an RGB48 file, which causes FFVideoSource() to be rather "confused" about it.
The range information (originally full range) is also lost, which of course is very bad for any automation you might have depending on it to be set correctly in the Avisynth frame properties.
On the other hand, remuxing it to .mkv has no issues at all and preserves everything correctly.
So, in a nutshell, if you get an FFMpeg muxed MJPEG2000 in mxf, please remux it to a sensible container like mkv before indexing it, otherwise the result is gonna be completely wrong.

FranceBB
10th November 2023, 15:25
ffms2_r1369 (https://ppp.woelkli.com/s/H4kXCaZczp6cksc) (pass: BLxmx6YsVJ03):
- AviSynth: fixed GetParity (rffmode > 0) and _FieldBased. (bugs introduced in the previous version)
- AviSynth: added support for audio channel mask.
- AviSynth: fixed fps (rffmode > 0). (bug introduced by the new FFmpeg API from the beginning of 2023)
- ffms2@cf7c4b2;
- ffmpeg@9310ff;
- zlib 1.3;
- dav1d 1.2.1;
- libxml2 v2.11.5.

Don't hate me, but I'm still having issues with files that have Italian accents. :(

LeXXuz
11th November 2023, 11:49
Don't hate me, but I'm still having issues with files that have Italian accents. :(

Same here with german characters. I stopped using ffms and LSmash some time ago. At least DGIndex doesn't have the slightest problem with special characters in file names. And it is still the most precise indexer imho as long as you use it on elementary steams and not containers.

StvG
11th November 2023, 15:51
Don't hate me, but I'm still having issues with files that have Italian accents. :(

Same here with german characters. I stopped using ffms and LSmash some time ago. At least DGIndex doesn't have the slightest problem with special characters in file names. And it is still the most precise indexer imho as long as you use it on elementary steams and not containers.

Post #2769 (https://forum.doom9.org/showthread.php?p=1992722#post1992722).

FranceBB
11th November 2023, 19:39
If you have issues about unicode filenames complain to the used app for reading/opening the avs script that doesn't support unicode filenames


That is quite literally FFMpeg, which, in theory, does, so there must be something else going on here.
Validating scripts with ffprobe and ffmpeg results in an error on both sides.
I'll come up with more examples on Monday.

StvG
11th November 2023, 19:53
Just a heads up that from this version (https://forum.doom9.org/showthread.php?p=1986154#post1986154) there is a regression about the handling of the unicode filenames...

... I'll upload the code used for my builds to codeberg and then post a new version.

Wait for the new version or use old version.

StvG
12th November 2023, 01:32
The source code is here (https://codeberg.org/StvG/ffms2).

ffms2_r1386 (https://codeberg.org/StvG/ffms2/releases/tag/r1386)

@FranceBB, you can try this version.

If AvsPmod is used, make sure the used version is >=2.7.5.5 to avoid issues with the file names.

FranceBB
12th November 2023, 02:32
The source code is here (https://codeberg.org/StvG/ffms2).

ffms2_r1386 (https://codeberg.org/StvG/ffms2/releases/tag/r1386)

@FranceBB, you can try this version.

Woah, thank you a lot, gotta try it straight away! :)

Ok, so, tested on a real life workflow (slowmotion from 100fps to 25fps and encode in XDCAM-50) with a simple file called:

Test accenti àèéùì.MP4


Version ffms2_r1369 (old):
Validate: FFVideoSource: Failed to open 'Test accenti Ã*èéùì.MP4'

https://i.imgur.com/WiniJlM.png


Version ffms2_r1386 (new):

the encoding started just fine

https://i.imgur.com/19oH7X2.png

and went on to complete just fine. ;)

https://i.imgur.com/7EOVgPS.png

Thank you, thank you, thank you!
I upgraded all my production systems. :)
This is gonna be a very nice surprise for the news department guys as they clock in just a few hours, at 5AM.

kedautinh12
12th November 2023, 03:24
Strange, I'm using with AvsPmod 2.7.5.5 but still have error
https://i.imgur.com/w4dfjxX.png
Sample: https://drive.google.com/file/d/1VAcp5b28eCjlqwZoNxd0z3Ge4R3pRbJK/view?usp=sharing

StvG
12th November 2023, 03:35
Strange, I'm using with AvsPmod 2.7.5.5 but still have error
https://i.imgur.com/w4dfjxX.png
Sample: https://drive.google.com/file/d/1VAcp5b28eCjlqwZoNxd0z3Ge4R3pRbJK/view?usp=sharing

Make sure you don't have other version than r1386.

kedautinh12
12th November 2023, 03:51
Make sure you don't have other version than r1386.

I'm sure, only one file .dll and .exe in ffms folder and in the avs+ autoload folder don't have any version of ffms2

StvG
12th November 2023, 04:04
What about open the script with avsmeter64/virtualdub2?

kedautinh12
12th November 2023, 04:07
What about open the script with avsmeter64/virtualdub2?

I trid with Megui but I got this error too

StvG
12th November 2023, 04:10
Are you sure your path to the file is correct or you have write permission?

kedautinh12
12th November 2023, 04:26
Are you sure your path to the file is correct or you have write permission?

I'm sure, and I use it normally with non-utf8 file name in same folder

kedautinh12
12th November 2023, 04:37
I tried with DGDecNV and it's work normally

StvG
12th November 2023, 04:37
I'm sure, and I use it normally with non-utf8 file name in same folder

What's your system locale?

https://ibb.co/SrF2NZy

kedautinh12
12th November 2023, 04:45
I changed to Vietnamese region and restart but the error continues

StvG
12th November 2023, 04:54
I change system locale to Vietnamese. AvsPmod errors but avsmeter64, virtualdub2 is fine.

kedautinh12
12th November 2023, 04:59
I change system locale to Vietnamese. AvsPmod errors but avsmeter64, virtualdub2 is fine.

so why need change system locale when DGDecNV don't need change it and working with AvsPmod and Megui??

StvG
12th November 2023, 05:04
You wrote you have the same error with avsmeter64 and virtualdub2 (post #2785) but they are fine. The error is only with AvsPmod.

StvG
12th November 2023, 05:11
Try this AvsPmod (https://filebin.net/43ggbshts33bxncf). It should work.

Edit: Doesn't DGDecNV index the file with own app? You don't index the file with DGDecNV and AvsPmod like you do with ffms2, right?

kedautinh12
12th November 2023, 05:25
You wrote you have the same error with avsmeter64 and virtualdub2 (post #2785) but they are fine. The error is only with AvsPmod.

I said same error with Megui. Ok i'd rather change file name utf8 to non-utf8 or use DGDecNV for utf8 file name with AVSPmod or Megui than change and learn to use other app

StvG
12th November 2023, 05:38
Try the AvsPmod version from my previous post.

As far as DGDecNV - it's irrelevant to this issue because it opens/creates the files with own app and then you just use the index file in AvsPmod/Megui. On the other side ffms2/lsmashsource are using AvsPmod/MeGui (or whatever app) to open/index the file. So as already wrote in post #2769 - "If you have issues about unicode filenames complain to the used app for reading/opening the avs script that doesn't support unicode filenames or just active the Unicode UTF-8 support in Windows (if available)." in this case it's still AvsPmod issue especially if avsmeter64/virtualdub2 are working.

Edit: If you have issues with MeGui too, raise the issue to their devs to support UNICODE file names.

kedautinh12
12th November 2023, 05:57
Try the AvsPmod version from my previous post.

As far as DGDecNV - it's irrelevant to this issue because it opens/creates the files with own app and then you just use the index file in AvsPmod/Megui. On the other side ffms2/lsmashsource are using AvsPmod/MeGui (or whatever app) to open/index the file. So as already wrote in post #2769 - "If you have issues about unicode filenames complain to the used app for reading/opening the avs script that doesn't support unicode filenames or just active the Unicode UTF-8 support in Windows (if available)." in this case it's still AvsPmod issue especially if avsmeter64/virtualdub2 are working.

Edit: If you have issues with MeGui too, raise the issue to their devs to support UNICODE file names.
I don't think that. L-smash-works 20231010 1144.0.0.0 works normally with both AvsPmod and Megui until Asd-g release this commit (https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/commit/5b27e80294cc95dd71f66ce891dbf44882e00dd1) and it's not work anymore with utf8 file name when I use L-smash-works 20231106 1147.0.0.0. Issue here (https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/issues/49). That proves Megui and AvsPmod already support .avs file have utf8 character

kedautinh12
12th November 2023, 06:17
I tested with three latest build ffms2, L-SMASH-Works, DGDecNV in Megui and AvsPmod. Two is ffms2 and DGDecNV can index file but only DGDecNV can open preview video normally. Older ver of L-SMASH-Works can index and open preview video normally

StvG
12th November 2023, 06:19
Why don't you test the AvsPmod from post #2794 (https://filebin.net/43ggbshts33bxncf) with ffms2_r1386 and your file?

https://ibb.co/GkR10jk

kedautinh12
12th November 2023, 07:49
Why don't you test the AvsPmod from post #2794 (https://filebin.net/43ggbshts33bxncf) with ffms2_r1386 and your file?

https://ibb.co/GkR10jk

The AvsPmod from post #2794 (https://filebin.net/43ggbshts33bxncf work normally with ffms2_r1386. After, I checked the older ver r1369 and it works with Megui, AvsPmod 2.7.5.5 but can't use with your AvsPmod shared
https://imgur.com/a/i9F2OYO