Jump to content
All Servers Online: EmuMovies Sync | Launchbox Sync | FTP USA | FTP Europe ×

brolly I need you to show me where I'm wrong

Recommended Posts

Then I need you to show me how to fix it. :)


Okay playing with one of DamnedRegistrations 3DO submissions...and for some reason the audio from the game play warps to the end of the video.


Note this is all suppose to be one line...edit as needed...it's also not universal...so you actually have to use the video listed for things to turn out fairly correct.

ffmpeg.exe -y -vn -an -i "C:\Users\Guy\Desktop\Video Test 3\Panasonic 3DO\Eye of Typhoon, The (Korea) G.avi" -vn -an -i "C:\Users\Guy\Desktop\Video Test 3\Panasonic 3DO\Eye of Typhoon, The (Korea) T.avi" -filter_complex "[0:v] split [GameSplitV_1] [GameSplitV_2];[GameSplitV_1] trim='start=0:duration=28.5', setpts=PTS-STARTPTS, fade='t=in:d=1.5' [GameV_1];[GameSplitV_2] trim='start=28.5:duration=1.5', setpts=PTS-STARTPTS [JoinGameV_1];[1:v] split [TitleSplitV_1] [TitleSplitV_2];[TitleSplitV_1] trim='start=1.5', setpts=PTS-STARTPTS, fade='t=out:st=5:d=1.5' [TitleV_1];[TitleSplitV_2] trim='duration=1.5', setpts=PTS-STARTPTS [JoinTitleV_1];[JoinTitleV_1] [JoinGameV_1] blend=all_expr='A*(if(gte(T,1.5),1,T/1.5))+B*(1-(if(gte(T,1.5),1,T/1.5)))' [JoinV_1];[0:a] asplit [GameSplitA_1] [GameSplitA_2];[GameSplitA_1] atrim='start=0:duration=28.5', asetpts=PTS-STARTPTS, afade='t=in:d=1.5' [GameA_1];[GameSplitA_2] atrim='start=28.5:duration=1.5', asetpts=PTS-STARTPTS, afade='t=out:d=1.5' [JoinGameA_1];[1:a] asplit [TitleSplitA_1] [TitleSplitA_2];[TitleSplitA_1] atrim=start=1.5, asetpts=PTS-STARTPTS, afade='t=out:st=5:d=1.5' [TitleA_1];[TitleSplitA_2] atrim=duration=1.5, asetpts=PTS-STARTPTS, afade='t=in:d=1.5' [JoinTitleA_1];[JoinGameA_1] [JoinTitleA_1] amerge, pan='stereo:c0=c0+c2:c1=c1+c3' [JoinA_1];[GameV_1] [GameA_1] [JoinV_1] [JoinA_1] [TitleV_1] [TitleA_1] concat='n=3:v=1:a=1' [Video] [Audio]" -map "[Video]" -map "[Audio]" video1.mp4

So I'm getting close to being able to encode everything with just FFMpeg...no AviSynth or fancy IDE's.


** Update **


Okay the audio warp only happens in VLC...WMP doesn't suffer the same issue...so my best guess is it's ether one of two things...the source audio for Title source was cut short...or the more likely...my sloopy cutting and splicing isn't accurate enough.


Guess I'll just have to code things and see how things turn out...that said...brolly if you do see an issue or two let me know. :)

Link to comment
Share on other sites

Dude, I grasped when I saw that command line lol


If it was aviSynth I could probably be useful to you, but with ffmpeg not so much as I've never used filter_complex at all.


Still, by giving a quick look at your code and even though I don't understand all the options, this didn't seemed right to me (I might be wrong though):

[TitleSplitV_1] trim='start=1.5', setpts=PTS-STARTPTS, fade='t=out:st=35:d=1.5' [TitleV_1];


st=35? I don't think the video has 35 seconds at this point. Shouldn't it be st=5 here?


In the audio split you seem to have it right:

[TitleSplitA_1] atrim=start=1.5, asetpts=PTS-STARTPTS, afade='t=out:st=5:d=1.5' [TitleA_1];


Also not sure if you always need to set a value for st in the fade out or if it will assume the stream duration if you don't. Mentioning it since you didn't set it here:

[GameSplitA_2] atrim='start=28.5:duration=1.5', asetpts=PTS-STARTPTS, afade='t=out:d=1.5' [JoinGameA_1];


I suggest you to cut that script smaller and output the streams separately this should help figuring exactly where the problem is. I don't have time to test it right now, but if you can't figure it meanwhile I can give it a shot tomorrow night or so.


What's wrong with aviSynth anyway? :)


Link to comment
Share on other sites

This is my first attempt at using filter_complex...as most the stuff I do is through vf.


Well AviSynth I don't need help making this happen...as I'm the one that wrote the generator for Circo some time back.


Heh you are correct...it doesn't have 35 seconds in it at all...as it's only 8 seconds long...not sure how I fat fingered a 3 in there. (corrected the source)


On that afade line...it does assume frame 0 for start...unless otherwise defined.


There is nothing wrong with AviSynth...it's just more effort to setup correctly...and takes a little bit longer to get through the processing of the files.


So if I get this working correctly, it'll just make things more streamlined is all, both in setup & execution.


** Update **


Well checked the media it's self.

===================== General =====================Complete name               : C:\Users\Guy\Desktop\Video Test 3\Panasonic 3DO\Eye of Typhoon, The (Korea) T.aviFormat                      : AVIFormat info                 : Audio Video InterleaveFile size                   : 6.28 MBDuration (ms)               : 8s 0msTotal bitrate               : 6 590 KbpsEncoded library             : VirtualDub build 35491/release===================== Video =====================Id                          : 0Format                      : x264Codec Id                    : x264Duration (ms)               : 8s 0msBitrate                     : 5 104 KbpsWidth                       : 640 pixelsHeight                      : 480 pixelsAspect ratio                : 4:3Framerate                   : 60.000 fpsBits/(Pixel*Frame)          : 0.277Stream size                 : 4.87 MB (77%)===================== Audio =====================Id                          : 1Format                      : PCMFormat_Settings_Endianness  : LittleFormat_Settings_Sign        : SignedCodec Id                    : 1Duration (ms)               : 7s 575msBitrate mode                : ConstantBitrate                     : 1 536 KbpsChannel(s)                  : 2 channelsSampling rate               : 48.0 KHzBit depth                   : 16 bitsStream size                 : 1.39 MB (22%)Interleave duration         : 19 ms (1.13 video frame)Interleave preload          : 500 ms

So it is short. :(


However checking the Game Play video:

===================== General =====================Complete name               : C:\Users\Guy\Desktop\Video Test 3\Panasonic 3DO\Eye of Typhoon, The (Korea) G.aviFormat                      : AVIFormat info                 : Audio Video InterleaveFile size                   : 59.8 MBDuration (ms)               : 30s 0msTotal bitrate               : 16.7 MbpsEncoded library             : VirtualDub build 35491/release===================== Video =====================Id                          : 0Format                      : x264Codec Id                    : x264Duration (ms)               : 30s 0msBitrate                     : 15.2 MbpsWidth                       : 640 pixelsHeight                      : 480 pixelsAspect ratio                : 4:3Framerate                   : 60.000 fpsBits/(Pixel*Frame)          : 0.823Stream size                 : 54.3 MB (91%)===================== Audio =====================Id                          : 1Format                      : PCMFormat_Settings_Endianness  : LittleFormat_Settings_Sign        : SignedCodec Id                    : 1Duration (ms)               : 30s 0msBitrate mode                : ConstantBitrate                     : 1 536 KbpsChannel(s)                  : 2 channelsSampling rate               : 48.0 KHzBit depth                   : 16 bitsStream size                 : 5.49 MB (9%)Interleave duration         : 17 ms (1.02 video frame)Interleave preload          : 500 ms

You'll notice it's correct for duration. No idea why they are different...unless DamnedRegistrations used some setting to trim silent audio.


So I guess the script is correct as far as it can be right now...it's time to code...and I'll have to be sure to check duration and add padding where required.

Link to comment
Share on other sites

The reason you're seeing that is because of the specific game. There's no music during the title sequence (like many games I've done). Just some gong followed by a really lame voiceover saying, "The eye of the typhoon". Bad fighting game lol. I actually timed it to make sure he finished speaking before the video ends so it wouldn't get too cut off when finalized. I didn't trim the audio or anything, I'm only using VirtualDub. Very rarely do I use an outside source for audio that I had to edit, trim or fix in Audacity.


A lot of title vids I've done are completely silent too actually, better than nothing I suppose. I've come across many games that don't even have 8 seconds to record, so I have to do some seamless looping or use a still image. Check out "Citizen X (USA) T.avi" in my Sega CD folder for example. The real title screen only lasts around 3 seconds, so I had to loop that as best as possible. Tons of games I've done that for so far, since I think every vid snap needs a title even when not totally genuine. Worth the effort!

Link to comment
Share on other sites

@ DamnedRegistrations


This really shouldn't be an issue...I just need to figure out how to deal with it. If the concat command padded the last audio segment, like it does the ones preceding the last...this already would be a non issue.


I'll get it figured out...just a matter of going a little bit more bald. :)


** Update **

ffmpeg.exe -y -i "C:\Users\Guy\Desktop\Video Test 3\Panasonic 3DO\Eye of Typhoon, The (Korea) T.avi" -shortest -filter_complex "[a] apad [Audio]" -map 0:0 -map "[Audio]" -c:v copy -c:a pcm_s16le video1.avi

Well when I run the above to create a new Title video, then use it in the first command line listed...things turn out perfect...I just have yet to figure out how to apply apad in one run. :(

Link to comment
Share on other sites

Well found in the Full Help file for FFMpeg the following:

apad AVOptions:  packet_size       <int>        ..F.A... set silence packet size (from 0 to INT_MAX) (default 4096)  pad_len           <int64>      ..F.A... number of samples of silence to add (from 0 to I64_MAX) (default 0)  whole_len         <int64>      ..F.A... target number of samples in the audio stream (from 0 to I64_MAX) (default 0)

So decided to manually set the value to pad by.


sample rate * bits per sample * channels * duration (seconds)


So 48000 * 16 * 2 * 0.5 = 76800


However ffmpeg for god knows what reason gets a buffer over flow when adding:

[1:a] apad='pad_len=76800', asplit [TitleSplitA_1] [TitleSplitA_2];

What the hell am I doing wrong...


** Update **


Just did whole_len and same issue. :(


48000 * 16 * 2 * 8 = 12288000

[1:a] apad='whole_len=12288000', asplit [TitleSplitA_1] [TitleSplitA_2];
Link to comment
Share on other sites

7s 575ms + 500ms > 8s maybe it has something to do with it? Try a smaller value and see if that works.

Are you sure that formula is correct? Do you need to use the number of channels on it?


Did you try using apad without parameters with shortest? From the docs about apad:

"Pad the end of a audio stream with silence, this can be used together with -shortest to extend audio streams to the same length as the video stream."


Link to comment
Share on other sites

In post #6 I use shortest...and it works fine there...since there is only one audio stream...things seem to go all wonky if there are multiple audio streams.


Well maybe I should be more clear about the buffer issue...ffmpeg keeps adding more...over and over...it's not that the requested size is to large...which it maybe...but it's not as large as ffmepg makes it out to be...with is never ending.


The formula is correct far as I'm aware...not a guru. :)

Link to comment
Share on other sites

I don't think that you will have to deal with multiple audio streams in Emumovies stuff :)


Try removing the channel number from your formula, maybe the samples number is per channel.


Link to comment
Share on other sites

For the final video...yeah only one audio stream...but I typically have one for each video that is being concatenated into the final video...that is where the issue is.


If I do only one video...not a composite...then apad using shortest works fine...but when I get into concatenating everything...stuff goes to hell.


At this point I'm just going to file a bug report and see what comes of it...as for my script...I'll just recreate source files as needed, with proper length audio streams...trim and pad where required...then concat them afterwards.


More time...more disk thrashing...but it'll get done right...I also don't expect this to be the norm...I just got oddly lucky to stumble upon this issue is all.


Granted this issue doesn't even raise it's head except with VLC...so complete corner case.


For the end user this will still seem faster...even though it has the possibility of actually taking more time...should there be a large number of files suffering from this issue in a given batch.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...