Adding Audio To FLV in ActionScript - apache-flex

I have an FLV without sound, and a sound file without video. Can I combine them using Actionscript? Where should I start?

yes you can, here are a couple of possibilities
1/you could use OSMF which gives you the possibility of playing elements in parallel. Check this video for an intro to OSMF
http://gotoandlearn.com/play.php?id=129
2/ Otherwise, here's a couple of tutorials about video & sound basics
http://gotoandlearn.com/play.php?id=61
http://gotoandlearn.com/play.php?id=61
then you should create a few functions to ensure that when you call play or stop both the video & audio play or stop together. this should be easy to implement after you've watched the tutorials

Related

Streaming audio in A-frame

I am building a multi-user experience in A-frame using NAF, and I have some positional audio containing music tracks in different points of the scene. I'm trying to figure out if it's possible to make it that the music is listened simultaneously by all the connected users. It is very important that they are positional, since I need several audio sources in the scene. At the moment, the tracks start when you enter the experience, so each person hears them from the start when they access the scene. This is the file that I'm using right now: https://glitch.com/~indigo-roomy-supermarket
I tried with the broadcast-component, but didn't manage. I thought of trying a workaround using a stream of twitch and hiding the video, trying to project it to a primitive, but also doesn't work so far (just managed to attach it to a div over the scene, I can hide the video but the audio would never be positional). Here the file where I tried it (not networked, but it should be the same): https://glitch.com/~twitchtest-01 I know that there's the option of connecting vimeo to a-frame using this: https://github.com/vimeo/aframe-vimeo-component but the audio itself is not positional, so it doesn't really solve my problem (also, I don't know if it would work with vimeo live).
If somebody knows a way to do this, I would greatly appreciate if you can share your wisdom. Thanks a lot!
I don't think that's easy.
Assuming you have streaming audio servers at your disposal like this then the way I would approach this, is:
fetch an audio stream and once the download returns, get the source buffer
override the source buffer of your positional audio element (something like this.el.getObject3D('sound').children[0].source.buffer) with the newly created audio buffer.
This might work.
If it doesn't, then create you own audio element component by using positional ThreeJS sound directly with setMediaStreamSource.
My assessment would be that this takes several days just to prototype alone. Having said that, I am pretty sure it's doable.

Flex 4: VideoDisplay can play MP3 files?

Is it possible to play MP3 files using the VideoDisplay or VideoPlayer components?
Thank you.
Actually, yes they can play MP3 files. I've just got it working by simply passing the path of the MP3 to a VideoPlayer component instance.
Although I wouldn't recommend using a video component to solely play audio files, I agree that it's sometimes appropriate to play a sound file in a video display component. In my case I have a mixed list of audio and video media items and want a unified preview area and playback/scrub controls.
Why would you use a video component to play a sound file? Either way, you should probably google before posting here. This is how you do it:
var snd:Sound = new Sound(new URLRequest("smallSound.mp3"));
snd.play();

Can I play a video backwards in AIR

I need to play a .mov file backwards in my Flex app. Some help??
Likely not possible.
Video files are simply not designed to play backwards (the compression takes advantage of forwards [and backwards] temporal information) - a decoder would have to be specially-coded for such a feature.
Perhaps use an external tool to reverse the video.
If Flex allows per-frame control, then you may be able to achieve some results (perhaps not good ones) by frame-stepping backwards from the end. Your mileage may vary.
One way to do it is to have the video on the timeline of a flash file (when you drag the video into flash it will give you the option).
then with actionscript you need to make sure the movieclip is paused and manually move the playhead of the currentframe backwards at about the frame rate of the movie.
it isn't trivial but it's possible.
Note that you won't have the sound working.
HTH.

Multi-bitrate/dynamic rate for progressive FLV playback

Is there a way to get multi-bitrate playback working with progessive playback without having to download all versions of the file? People all coming up with all kinds of cool ways to make progressive feel like streaming. I wouldn't be surprised if there is also a hack for this. Any module names or reading resources that people in the know in this field can recommend?
I have a suggestion, more of a hack really.
I hope you have small clips in mind, otherwise it might get pretty slow for big files.
How about you have audio in a separate file(either flv with no video encoded or just plain mp3) and then your flv.
You load your flv, you play make 'screengrabs' at runtime using BitmapData's draw method and store them in a Vector/Array and that should be it. You can play them back at dynamic speeds,
As for the mp3, you'll next the change the pitch. Andre Michelle has a great article about that.
Is the pricing the issue in not streaming flvs? Red5 is opensource.

.NET : How to Create thumbnail from flash

Is there any way where i can create a thumbnail image from a flash movie file(flv /swf) [NOT FROM A VIDEO File ] in ASP.NET ? Any samples of implementation ?
you can use ffmpeg to create thumbnails of the flash video
For .flv you can use ffmpeg to convert parts of the video (e.g. one frame) into an image (sequence)
I've used it as command-line application by calling Process.Start(), but there is at least one wrapper for .NET (I haven't tested it myself):
http://www.codeplex.com/ffmpegdotnet
For .swf I don't know any way to achieve this without some Adobe tool.
for flv it can be done easily, as others mentioned ...
for swf, it depends HIGHLY on the swf ... if the swfs visual appearence is determined by code, there is no other way than to embed a flash player in you app and either let the flash player make the snapshots, encode them as JPEG/PNG, and send them somewhere using TCP or LocalConnection (a flash<->flash communication connection, which can be used with C# as well) or try to somehow grab its output buffer yourself ... the first possibility should be no more than 10-20 lines of actionscript code ... don't know about the latter ...
other than that, you might use an external command line converter ... there are a few floating around the web ...
greetz
back2dos
Take a look at this article, it should point you in the right direction. It uses SharpFFmpeg to extract thumbnail images from movie clips from a variety of formats.
the only way to get an image, is to use a full flash client that starts playing and allows you to capture the first frame.
I would take a close look at flirt (they actually have an example that renders pngs)
Maybe some of the other flash libraries may be of help ( swfdec gnash swift tools gplflash)
Gnash is probably the best choice since its the most mature project out there, but i do not know how easy it is to integrate into command line tools or into your own projects.
We have been working on this in my company, and we got a proof of concept working pretty fast (but the project we made it for is on hold right now). I am not able to share the code, but I can give you some pointers.
It is not pure ASP.NET, but maybe you can still use it. We made a windows service that can be called from ASP.NET.
Basicly you install the flash plugin on the server, the windows services can then simply open the swf through the swf ActiveX component and then you can grap a picture of the whole thing. It works pretty well, notice that you do not have to actually render the ActiveX component on screen to capture the picture.
Check out this post. It does not tell you everything but I guess it provides the ground work required for it. You probably have to figure out how to get the object tag out of the flash-html you are trying to download from a web page. After that you'd have to figure out when to capture the frames. Its a long ride however. You don't need the asp.net part. Just concentrate on the windows project part. Hope this helps. :)

Resources