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 Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 5th October 2020, 21:57   #1  |  Link
Starduster
Registered User
 
Starduster's Avatar
 
Join Date: Jun 2007
Location: Ann Arbor, MI
Posts: 124
Can't create mp4 from avs with ffmpeg

I'm just trying to include a blank slide with a subtitle between clips using same size, fps,audio, etc.. I'm using the following (with and without the tone and audiodub):

Code:
fa=Tone(length=3.0, type="Silence", samplerate=30, channels=2)
v=BlankClip(90,1280,720)
sld=audiodub(v,fa)
sld=Subtitle(sld,"This is a test", align=5, size=24)
sld=sld.convertFPS(30)
sld=sld.ConvertToRGB32()
sld=sld.SSRC(22050, fast = True)
sld
It works fine in Media Player but when I try to save it as an mp4 with the following it's just a black screen.

ffmpeg -i clip.avs clip.mp4

Does anyone know what I'm doing wrong?
__________________
Life is more interesting viewed upside down
Starduster is offline   Reply With Quote
Old 6th October 2020, 15:16   #2  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
What does the ffmpeg console output say ?

What format are the clips ? Ideally you'd want to match them. When I run that script and commandline I get AVC YUV444 and AAC audio

How are you checking the output video ? Some programs might not be able to play AVC in YUV444 configuration

Do you have x86 / x64 mismatch between ffmpeg, avisynth ?

You're sending RGB32, but by default ffmpeg will convert to YUV444 unless you use -c:v libx264rgb . Or you can add ConvertToYV12(matrix="rec709") in the script for typical usage 4:2:0
poisondeathray is offline   Reply With Quote
Old 6th October 2020, 16:49   #3  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
try changing the last line from 'sld' to 'return sld'
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 6th October 2020 at 16:57.
Selur is offline   Reply With Quote
Old 6th October 2020, 19:59   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
try changing the last line from 'sld' to 'return sld'
Dont think would make any difference at all.
Last line "sld" == "Last=sld", and implied "Return Last" at end of script, exactly same effect as "Return sld".

Think PDR got it all covered in his post.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 6th October 2020, 23:54   #5  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by StainlessS View Post
Dont think would make any difference at all.
Last line "sld" == "Last=sld", and implied "Return Last" at end of script, exactly same effect as "Return sld".
Yes, you're right, it makes no difference - but your reason is slightly off.
"sld" as the final statement in a block is simply defined to mean "return sld" - there is no implied "return last".
(It is a myth that "return last" is the default action, and there are some cases when 'last' is not returned, such as when the final expression is not a clip. See here.)
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 7th October 2020, 10:09   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
I stand corrected,
tis reassuring but also slightly disconcerting to know that you are constantly on 'my case',
waiting to spank me at the 1st opportunity.

Nice to see that you are still alive [comment on covid, not your age, but also nice for that too].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 9th October 2020, 18:35   #7  |  Link
Starduster
Registered User
 
Starduster's Avatar
 
Join Date: Jun 2007
Location: Ann Arbor, MI
Posts: 124
Thanks guys, sorry about the delay... out of the office for a while. I started to answer PoisonDeathRay's questions but I thought I'd try to narrow things down first and found something... again that I don't understand. I set up a test to create an .mp4 from a single .avs with that code. I found that if I comment out the line, sld=sld.SSRC(22050, fast = True), it works! That's there to match all the other clips audio. So, why would that stop the subtitle from showing??
__________________
Life is more interesting viewed upside down
Starduster is offline   Reply With Quote
Old 9th October 2020, 20:27   #8  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
It shouldn't, and I couldn't reproduce any of this here. The script as given, with or without the SSRC line commented out, when converted as demonstrated in the OP, still produces a video clip with the subtitle visible.

When it doesn't, is when trying to preview the script using ffplay (or mpv using the default vo=gpu), but that's a known quirk of how the alpha channel is initialized and how libavformat responds to it.

BlankClip defaults to generating RGB32 clips, so omit ConvertToRGB32 entirely. You don't need it. You can fix the alpha issue by using RGBAdjust(ab=255).

You could also tell BlankClip to generate RGB24 using pixel_type="RGB24" and then follow it with AddAlphaPlane(), which makes it bgra but gives it the correct opacity value so that you can see what the video looks like:
Code:
fa=Tone(length=3.0, type="Silence", samplerate=22050, channels=2)
v=BlankClip(90,1280,720,pixel_type="RGB24",fps=30).AddAlphaPlane()
AudioDub(v,fa).Subtitle("This is a test", align=5, size=24)
qyot27 is offline   Reply With Quote
Old 9th October 2020, 21:20   #9  |  Link
Starduster
Registered User
 
Starduster's Avatar
 
Join Date: Jun 2007
Location: Ann Arbor, MI
Posts: 124
Get error... no function named AddAlphaPlane
__________________
Life is more interesting viewed upside down
Starduster is offline   Reply With Quote
Old 9th October 2020, 21:51   #10  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
Then you need to upgrade.
qyot27 is offline   Reply With Quote
Old 10th October 2020, 13:46   #11  |  Link
Starduster
Registered User
 
Starduster's Avatar
 
Join Date: Jun 2007
Location: Ann Arbor, MI
Posts: 124
I'm on 2.6.0... I thought that was the latest official build from http://avisynth.nl/index.php/Main_Page. is that not the right place?
__________________
Life is more interesting viewed upside down
Starduster is offline   Reply With Quote
Old 10th October 2020, 17:41   #12  |  Link
Starduster
Registered User
 
Starduster's Avatar
 
Join Date: Jun 2007
Location: Ann Arbor, MI
Posts: 124
Ok, I uninstalled 2.6.0 and installed Avisynth+ 3.6.1, ran the code you posted in a file called gs_10.avs, and double-clicked the .avs, and it displays correctly. Then I used the following:

ffmpeg -i gs_10.avs gs_10.mp4

I have a black, blank screen. gyot27, I know you didn't have any trouble doing this so I'm not sure what I'm doing wrong!
__________________
Life is more interesting viewed upside down
Starduster is offline   Reply With Quote
Old 10th October 2020, 17:44   #13  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
ffplay -i test.avs

If it doesn't show the subtitle, adjust the script.
qyot27 is offline   Reply With Quote
Old 10th October 2020, 18:27   #14  |  Link
Starduster
Registered User
 
Starduster's Avatar
 
Join Date: Jun 2007
Location: Ann Arbor, MI
Posts: 124
Oddly enough, ffplay works...
__________________
Life is more interesting viewed upside down
Starduster is offline   Reply With Quote
Old 11th October 2020, 05:02   #15  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
what about ffplay to test playback of the output file ?

ffplay -i gs_10.mp4
poisondeathray is offline   Reply With Quote
Old 11th October 2020, 12:18   #16  |  Link
Starduster
Registered User
 
Starduster's Avatar
 
Join Date: Jun 2007
Location: Ann Arbor, MI
Posts: 124
WTH?? Poisondeathray, that works! What does that mean?
__________________
Life is more interesting viewed upside down
Starduster is offline   Reply With Quote
Old 11th October 2020, 14:11   #17  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by Starduster View Post
WTH?? Poisondeathray, that works! What does that mean?
see post #2

Your player that you used initially probably does not support YUV444

Add ConvertToYV12(matrix="rec709") in the script for "regular" 4:2:0 video that is more universally supported
poisondeathray is offline   Reply With Quote
Old 11th October 2020, 15:37   #18  |  Link
Starduster
Registered User
 
Starduster's Avatar
 
Join Date: Jun 2007
Location: Ann Arbor, MI
Posts: 124
PDR, that worked! Was playing with WMP. Shame on me for not following ALL your instructions from the beginning. Humble thanks!!
__________________
Life is more interesting viewed upside down
Starduster is offline   Reply With Quote
Reply

Tags
avisynth, subtitle

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 15:59.


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