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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th September 2012, 23:53   #1  |  Link
wiseant
Registered User
 
Join Date: May 2007
Posts: 146
Can I use ffmpegsource/ffvideosource to determine video format

Hi

I looked through the docs for ffmpegsource - couldn't find what I was looking for.

Can I use ffmpegsource/ffvideosource avisynth plugin [ffms2.dll] to determine the type of video codec, i.e. 264, vc1, or mpeg-2/mpv/m2v re ts or m2ts clip?

TIA
wiseant is offline   Reply With Quote
Old 12th September 2012, 09:47   #2  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,100
FFMS2 does not expose that information, no.
TheFluff is offline   Reply With Quote
Old 12th September 2012, 14:10   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
You saw the MediaInfo demo in another thread
(http://forum.doom9.org/showthread.ph...78#post1590078)
MediaInfo allows you to use a template to query the info that your after, and you could I think access via RT_Stats funcs (although I have not tried it).
__________________
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 12th September 2012, 20:41   #4  |  Link
wiseant
Registered User
 
Join Date: May 2007
Posts: 146
@TheFluff
Thanks for the info

@StainlessS
Yes, I saw that MediaInfo demo - and did a test run with it - another great tool
Looks like that is best way to do this with an avisynth script - I have been avoiding using MediaInfo - probably cause I was too lazy to figure out all the syntax commands
wiseant is offline   Reply With Quote
Old 13th September 2012, 02:45   #5  |  Link
wiseant
Registered User
 
Join Date: May 2007
Posts: 146
@StainlessS

Well this seems to work as long as RTCall.avs is in the same folder i.e. D:\MediaTest along with MediaInfo.dll, MediaInfo.exe, and Template.txt

RTCall.avs

Code:
FN         = "D:\newmobcal1440_12mbps.ts"
filename   = "D:\MediaTest\mymedia.bat"
quote      = chr(34)
media      = "mediainfo.exe --Inform=file://Template.txt " + quote + FN + quote + " >> sept12.txt"
RT_TxtWriteFile(media,filename)
RT_Call("D:\MediaTest\mymedia.bat")
retrun ColorBars()
Template.txt:
General;ClipName->%CompleteName%\nVideoCodec:%Video_Format_List%\nAudioCodec:%Audio_Format_List%\n
Video;VideoWidth:%Width%\r\nVideoHeight:%Height%\r\nVideoFramerate:%FrameRate%\r\nVideoFrameCount:%FrameCount%\r\nVideoStreamSize in bytes:%StreamSize%\r\nVideoDuration in ms:%Duration%\r\nVideoBitrate in bps:%BitRate%\r\nPixelAspectRatio:%PixelAspectRatio%\r\nDisplayAspectRatio:%DisplayAspectRatio%\r\n
Audio;AudioDuration in ms:%Duration%\r\nAudioBitRate in bps:%BitRate%\r\nAudioChannels:%Channel(s)%\r\nAudioSamplingRate:%SamplingRate%\r\nAudioStreamSize in bytes:%StreamSize%

Output:
ClipName->D:\newmobcal1440_12mbps.ts
VideoCodec:MPEG Video
AudioCodec:AC-3
VideoWidth:1440
VideoHeight:1080
VideoFramerate:29.970
VideoFrameCount:1810
VideoStreamSize in bytes:104715052
VideoDuration in ms:60394
VideoBitrate in bps:13870984
PixelAspectRatio:1.333
DisplayAspectRatio:1.778
AudioDuration in ms:60128
AudioBitRate in bps:384000
AudioChannels:2
AudioSamplingRate:48000
AudioStreamSize in bytes:2886144

Works opening RTCall.avs in VirtualDub, AvsPMod, and MediaPlayerClassic

Perhaps you can come up with a better way to implement this . .
wiseant is offline   Reply With Quote
Old 13th September 2012, 09:29   #6  |  Link
wiseant
Registered User
 
Join Date: May 2007
Posts: 146
Updated:
By using Template.txt with RT_Call:

Code:
RT_Call("MediaInfo.Exe" + " --LogFile=" + "sept12.txt" + " --Inform=file://Template.txt " + "D:\newmobcal1440_12mbps.ts")
return colorbars()
wiseant is offline   Reply With Quote
Old 13th September 2012, 22:41   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Currently modding AutoCropLevelsGenny.avs to take a MediaInfo template (like yours above) with a paired replacement file,
so replacement file (line for line matching the mediainfo template) might contain eg:-

Code:
[MI_CLIPNAME]
[MI_VIDEOCODEC]
[MI_AUDIOCODEC]
[MI_VIDEOWIDTH]
[MI_VIDEOHEIGHT]
for the first first few lines in your template, so you could insert eg [MI_VIDEOCODEC] into the template log file (or AVS or Cmd or Group command file).
Would allow you to select any info you like that is output by Mediainfo and insert it into a generated log, avs or command file.

Also adding a group command file (containing commands for entire directory of clips) with header and tail templates,
so eg head might ask for input (eg bitrate) and tail might wait for keypress.
__________________
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 ???

Last edited by StainlessS; 13th September 2012 at 22:54.
StainlessS is offline   Reply With Quote
Old 14th September 2012, 04:56   #8  |  Link
wiseant
Registered User
 
Join Date: May 2007
Posts: 146
@StainlessS

Now that sounds interesting

I was thinking - it would be possible to analyze a video using various tools, create a custom batch file for encoding, and run the batch file from VirtualDub that can use x264 or HCEnc - all within an avs file . . .
wiseant is offline   Reply With Quote
Old 14th September 2012, 09:32   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
There is a prob with the above mentioned paired replacement, if you want a specific stream eg Eng subs for hard of hearing.
It would have no way at all of knowing what you want, it only matches the pair of template lines and simply replaces text.
You might be able to eg fetch data for the first n sets of subs and in script, make them into pseudo arrays using
RT_TxtAddStr, then scan the arrays to figure out which is closest to the required.
I dont myself really need that, I usually dump non wanted streams during ripping.
Anyway, the script when done will just be a demo, and intended as a starting point for more adventurous scripts.
Keep getting bitten by the 4096-1 string concatenation/allocation bug in 2.58 & 2.6a3, you really need to be using the RT_StrAddStr and
RT_TxtAddStr functs to avoid, thought I'd discovered another string bug, but turned out I had somehow reverted back to
an earlier version of this script function (StrReplace):-
http://forum.doom9.org/showthread.ph...02#post1590402

Although, I have to wonder if the bug can appear in eg LeftStr, MidStr etc too. EDIT: No it cant.

EDIT: 4096-1 bug, not affect filenames, too short.
__________________
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 ???

Last edited by StainlessS; 14th September 2012 at 18:55.
StainlessS is offline   Reply With Quote
Old 14th September 2012, 10:05   #10  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by StainlessS View Post
I have to wonder if the bug can appear in eg LeftStr, MidStr etc too.
The bug is due to incorrect interpretation of the value returned by _vsnprintf() and only affects string concatenation (with the '+' operator).

LeftStr, MidStr, etc, use strncat() and are not affected.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 14th September 2012, 10:13   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Danke Sehr.
__________________
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
Reply


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:29.


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