STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
210564
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2289 · P4578

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/28037716?noj=FRM28037716-14DO" width="1" height="1"></div>

Nick
Mail
Title
Required text body length: 2 characters. Maximum: 15000 characters.
A file is optional.

Age: 2323.19d   Health: 100%   Posters: 10   Posts: 15   Replies: 14   Files: 0

>>cb  4aug2013(su)04:33  No.7706  OP  P1
Different playing speed.

(Posting here because I have no idea where else to ask.)

Consider this SWF: http://swfchan.com/3/11576/?ruff.swf
When it was published back in 2004, it was pretty much on sync (at least on IE6, Windows XP and Flash 7, I think. Not in Firefox - this has already been an issue back then). Now it's not anymore.
What happens now: Even though I have this file on my hard disk, it starts off pretty slow, and then continues playing faster after one iteration - but not always.
Even when it doesn't start off slow, the video itself is a bit slower than what it ought to be. The video is supposed to play exactly 5 times for one full play of the audio track. Even when you extract the FLV and play it with VLC, the speed is different (not exactly sure if it's the correct speed with VLC).
I have spent many hours trying to inspect the file with different tools, but I really can't see the problem...

TL;DR
(1. Which are the factors that caused the SWF to not be in sync anymore?)
2. How do I get the SWF to play the video in real time? (5 video plays for one audio play. - It used to play fine.)

>>!///SWFAnts  5aug2013(mo)02:34  No.7709  A  P2R1
>>7706
It's probably because the flash plugin has changed a lot over the years, maybe the flash plugin of 2004 caused the visuals to be delayed a little bit more when it rewinded back to the first frame of the MovieClip. Somewhere in recent plugins it's possible that they made an optimization that caused this delay to become less or non-existance (perhaps by preparing for a pending rewind a couple of frames before the actual rewind rather than on the actual rewind). Could also be that some small change was made in the way it syncs frame rate to time.

The only way to fix this is to modify the flash file (make a new flash) by locking the visuals to the audio (using streaming audio). This will increase the file size and cause a small glitch when the timeline actually rewinds (though it's possible that future plugins will make this glitch smaller and smaller). File size is only increased if you repeat the same audio several times by extending the visuals a couple of iterations in order to make the glitch not appear on each and every audio repeat.

A different option is to make the visuals a bit shorter than the audio and begin playing the audio every time the first frame is hit. This will resync the audio with the visuals every time the visuals repeat, however there will most likely be an audio overlap or a brief period of silence before the audio repeats. If the flash is not in view the frame rate will drop to 1 if I remember correctly (to save CPU, a somewhat new feature of flash), which will make the audio gap between repeats huge (therefore loops that use this audio-resync-on-each-first-frame method will unfortunately not be very enjoyable if you have the flash open in a different browser tab, due to the very long period of silence between repeats, therefore I don't recommend this method but instead the first one I wrote).

Then again I don't really think you should care about having perfect sync in flash loops - it's accepted that they desync after a while. Only if constant visual/audio timing is super duper important should it be considered and as I said then I only recommend streaming audio (twice is a decent repeat number - will cause at least one seamless (fake) loop without a glitch in the audio and it will "only" double audio size. But of course, if the audio is small it's not as costly to repeat it several times, file size-wise).

>>Anonymous  6aug2013(tu)22:15  No.7729  B  P3R2
>>7709
Wow, thanks for such a detailed answer! So I guess I'll have to re-do the file. Still, I have some questions.

>maybe the flash plugin of 2004 caused the visuals to be delayed a little bit more when it rewinded back to the first frame
I don't understand that delay. On current browsers and Flash versions the SWF is played more slowly at the beginning. If the current way of display is more correct, then I don't find the causing SWF Tag or bits in the file above.
What is more, how come (back then) on Firefox the SWF played differently than in IE? Wasn't it the same flash player version?
And one more question that came to my mind: If you include a WAV audio file in a SWF on the flash editor, then the loop is seamless, although it gets converted in MP3. As far as I know, MP3 files always have a small silence at the beginning. And when you extract that MP3 (without converting it), then you indeed have that silence, that isn't played by Flash. How come?

>>!///SWFAnts  8aug2013(th)15:17  No.7747  A  P4R3
>>7729
I don't really understand the delay either, I'm just guessing. Makes sense that the plugin has somehow changed though, right?

Though I don't know for sure why Firefox and Internet Explorer played flashes a little differently in the past it was probably because IE used (and still uses) the ActiveX version of the flash plugin while other browsers does not. There are actually two different flash installers depending on if you're using IE or not. Also, IE was coded differently which could have affected flash playback.

It always annoyed me that the MP3 format requires a bit of silence in the beginning and end, thanks to these official specifications a MP3 should not be able to repeat seamlessly. What I think flash is doing however is cheating, either by skipping these gaps upon playback or by making a gapless MP3 upon build of the swf file (which breaks the official mp3 format specifications).

To this day I still haven't figured out exactly what magic it does to its Mp3s because if it makes a gapless Mp3 it should be possible to export the mp3 from the swf file, but those always seems to turn out as non-gapless mp3s (maybe programs like Sothink SWF Decompiler are "fixing" the mp3 to follow official specifications upon export? Seems unlikely since all such decompilers does it). On the other hand, if flash simply skips leading/trailing gaps in mp3s it should be possible to use mp3s in flashes and have them loop seamlessly, however then flash takes into account the gaps of the imported mp3. Is it built in to then respect the gaps, by flagging the mp3 somehow, or by adding small additional gapsto the track? Not likely since when you make a swf by not using official tools flash always plays gaps of mp3s and you have to make the mp3 gapless yourself before import (though it still doesn't work as well as when using the official flash making program).

If someone understands exactly what flash does to make their mp3s loop seamlessly I'd appreciate if he posted here.

>>cb  11aug2013(su)01:46  No.7785  C  P5R4
>>7747
I've talked to the creator of the flash once, and all I can recall is that Firefox plays (played?) flash movies depending on the cpu speed, and IE synchronized it in some way. Or maybe it was the other way around.
On his web site with all his loops he once wrote something like "fuck firefox and the way it handles flash!", but in private chat he withdrew it, I think. Unfortunately, I can't find the chat logs - it has been some years ago. Maybe I'll ask the NSA.

On the gap issue: With which program did you check that there is a gap in the decompressed mp3 file? The gap could be the decoders "fault", like LAME does. Here's one idea to test it, if you have official tools available (I haven't):
Create a SWF file with a WAV track and check if it really loops seamlessly. Extract the MP3 audio track from the created SWF, and create a *new* SWF using the extracted MP3.
If it still loops seamlessly, then we can assume that only the combination of flash encoder *and* decoder result in a perfectly loopable MP3. It could also mean that the audio track isn't flagged in some way, but flash breaks the official specification.

>>!///SWFAnts  12aug2013(mo)02:41  No.7801  A  P6R5
>>7785
You've actually talked with the creator of flash? Who exactly did you speak to?

I did a quick test doing what you suggested (just to be sure) and the exported MP3 from the swf file had exactly 0.060952 sec of silence added to it by Sothink's SWF Decompiler (counting both beginning and end silence). I took that MP3 file and made a quick flash loop of it using Adobe's official Flash program and indeed the gap was there (told Flash to use imported mp3 quality so it wasn't re-encoded).

That's why I always recommend using WAV files when creating seamless audio loops in flash, otherwise there will always be a gap of silence upon repeat.

Foor good measure I exported the mp3 file from the new swf I just created, turns out the total silence gap was now 0.086944 sec. Interesting because it means Sothink adds silence upon export even if there already is silence. Note how only 0.025992 sec of silence were added now, roughly 2.5 times shorter than the first time. Strange.

I check for gaps using Audacity 1.2.3, but you can hear it too just by queueing up the two mp3s after each other in WinAmp. Although it's odd because WinAmp should skip the gaps to provide seamless transactions between songs (for example some CDs have that). Could this mean that the gap I'm seeing in Audacity and hearing in WinAmp and the new swf file is not actually the leading trailing gaps of the mp3 format, but instead just gaps that Sothink adds on its own for some reason? Yes it could mean that. However then you should able to loop mp3s in flash seamlessly, however you can't unless you import them as wavs and export them as mp3s (where Adobe does the exporting).

Using Audacity I took a seamless wav audio loop and exported it to mp3 (using the lame_enc.dll library). I then imported the wave of the mp3 into Audacity. Around 0.025 sec of silence was added to the audio (only at the beginning, nothing at the end! Notice how this is the same amount that Sothink added to the mp3 the second time. If I repeatedly imported and exported the mp3 in Audacity it prolonged the audio with 0.025 sec of silence each time at the beginning (after three times the silence was around 0.075 sec).

Further interesting is that WinAmp picked up the gap, it didn't skip playing it. Meanwhile I found two mp3s from a CD that had seamless transition between two songs in WinAmp, when I imported those mp3s into Audacity they had silence at the beginning and end as well. Does this mean that the LAME mp3 library is to blame, or what?

How Mp3s work exactly is outside my area of expertise, we need a real mp3 expert to come along and help us to figure this out. But it seems to me that Flash does something with their mp3s upon export to make them gapless, and then Sothink "fixes" them when pulling those tracks out of the swf file. Best would be if a flash format dev from Adobe or old Macromedia explains it though, but I doubt it will happen. Maybe there's some documentation in the depths of the web, somewhere.

>>cb  13aug2013(tu)16:53  No.7820  D  P7R6
>>7801
No, unfortunately not, I wish I did. I talked to the creator of the flash I've mentioned in the OP: http://swfchan.com/3/11576/?ruff.swf

That's really strange with the MP3s. Actually most extractors I've encountered extract the MP3 without altering it. I think I remember to have used a hex editor and found the extracted MP3 exactly in the (unpacked) SWF.

The gap you've seen with Audacity could've been the decoder's fault, but I'm just guessing. Also the WinAmp thing baffled me a bit. But right now I've run out of ideas...

Maybe you want to check out the LAME Technical FAQ: http://lame.sourceforge.net/tech-FAQ.txt
It has information on why there's a silence before and after, but it still doesn't answer how flash handles audio formats.

>>!///SWFAnts  13aug2013(tu)17:03  No.7822  A  P8R7
>>7820
Ah, haha. I missed the "the" in >>7785 and thought you said "creator of flash once". I was wondering who that could have been.

>used a hex editor and found the extracted MP3 exactly
So the swf contained a mp3 with gaps yet the audio appeared seamless when looping in the flash? Hm.

Would be interesting to continue researching about the mp3-swf oddness, but I've done a bit of that in the past and it got me nowhere. Seeing as I won't be using the information for anything right now I'd rather just drop it. I guess you're just not supposed to know some things in life.

>>cb  15aug2013(th)17:49  No.7878  E  P9R8
>>7822
Here might be a summary of why there's a glitch: https://lists.nongnu.org/archive/html/swftools-co mmon/2004-03/msg00021.html

Also, one could take a look at the source code of e.g. SWFTOOLS. I did (not being an expert), and think that the MP3 gets extracted without conversion or modifying. I checked what I said with the hex editor, and it's true (had to install one first from source - long story). I'm trying to stick to this, but it is very difficult to find boards with people who have deep knowledge about the SWF format.

>>cb  16apr2014(we)21:31  No.12444  F  P10R9
Finally, I know more about this little gap. Well, I still don't really understand why the MP3 format has it at all, but the SWF mystery is solved:
>Btw: FlashIDE encoded MP3 loop gap-less, cause the SWF contains the original amount.
http://blog.andre-michelle.com/2010/playback-mp3- loop-gapless/

When you encode audio to MP3, there's silence added at the beginning and/or end. Afterwards, it's impossible to find out how many samples of silence have been added exactly; among other things this is because MP3 can't have "pure" silence (i.e. amplitude of 0) - but I'm unsure about this point. However, if you encode your seamless WAV file with the Flash IDE, the original amount of samples is stored in the SWF file (SeekSamples and SoundSampleCount). This way, the SWF decoder can deduce where the useful part is located in the MP3 file.

There's still one problem: I found out the number of samples and extracted the MP3 file, but when I extract that amount of samples from the audio, there's still a tiny little gap, and it still doesn't play as smooth as in the browser. I suppose there's another calculation to be done, which I haven't found out yet.

>>!///SWFAnts  #ADMIN#  17apr2014(th)02:32  No.12453  SWF  P11R10
>>12444
Nice work, pretty good to know. I had a look in the swf file format specifications at:

http://wwwimages.adobe.com/www.adobe.com/content/ dam/Adobe/en/devnet/swf/pdf/swf-file-format-spec.p df

SoundSampleCount is part of the DefineSound tag (page 178) but it seems the interesting stuff is in SoundInfo (page 180). InPoint and OutPoint seems to define where the actual audio starts and ends.

So now we know Flash doesn't do anything with their mp3 upon export, they simply store where the audio begins and ends in the mp3. So if I want to improve my flash loop maker service in the future I should scan the created flash file for any SoundInfo blocks and modify the InPoint/OutPoint values. I don't have plans to do it right now but maybe someday, thanks for letting me know this! Flash is such an amazing format, but it isn't easy to work with once the swf file has been compiled.

>>cb  22apr2014(tu)01:31  No.12553  H  P12R11
>>12453
I can't find the SoundInfo tag/struct/information in the SWF given in OP. It seems to be something else (in this case) defining which part of the MP3 is played.
>>!///SWFAnts  #ADMIN#  23apr2014(we)07:44  No.12621  SWF  P13R12
>>12553
Did you remember to decompress the swf information before scanning for the SoundInfo tag? Remember the first 8 bytes are never compressed of a swf file.
>>cb  26may2014(mo)23:14  No.13133  I  P14R13
>>12621
I used Adobe's own SWFInvestigator, and additionally SWiX, just to be sure. There's no doubt they decompress it beforehand, since they've both displayed all the other tags correctly.
Just to be double sure I manually decompressed it beforehand, but I still couldn't find SoundInfo.
Were you able to find SoundInfo with the SWF in the OP?
(Sorry for the late answer.)
>>!///SWFAnts  #ADMIN#  4jun2014(we)13:42  No.13229  SWF  P15R14
>>13133
No, I haven't scanned anything since I don't need to solve this for any of my current projects. Sounds strange if there were no SoundInfo tag after all. Sorry for the late answer here too, hehe.



http://swfchan.org/2525/index.shtml
Created: 4/8 -2013 04:33:00 Last modified: 14/12 -2019 09:00:01 Server time: 14/12 -2019 09:36:08