Recording a video with audio using GPUImageMovieWriter without jerkiness at start and end of recording? - ios6

I am using GPUImage framework to record multiple videos one after other in close intervals with having various filters enabled in real time using GPUImageVideoCamera and GPUImageMovieWriter.
When I record the video, video starts with a jerk(freeze for half a seconds) and ends with a jerk also. I know the reason behind this are the statements in which I pass the movieWriter object to VideoCamera's audioEncodingtarget.
So In my case when I record multiple videos one after other(with different objects of GPUImageMovieWriter), the video preview view freezes at start and end of each recording.
If I remove the audio encoding target statement, conditions improves significantly but of course I don't get the audio.
Currently I am using a AVAudioRecorder while recording to save audio tracks but I believe this is not a ideal work around.
Is there any way to solve this problem.
-- I looked at the RosyWriter example by Apple, their app work almost similarly but smoothly at almost constant 30 fps. I tried to use the RosyWriter code(after removing the code that add purple effect) to save the required videos while showing GPUImageVideoCamera's filtered view to user but in vain. When applied unmodified rosywriter code just records two videos and rest video fails. I also tried to pass in the rosywriter code the capture session from GPUImageVideoCamera but only gets videos with black frames and no audio.
Please help on how can I can record GPUImage filtered videos with audio without this jerkiness. Thanks in advance

I faced the same issue and here is my workaround.
As you pointed out, this problem happened because setAudioEncodingTarget method internally calls addAudioInputsAndOutputs to set audio in/output to the capture session.
To avoid this issue, I created justSetAudioEncodingTarget method for VideoCamera as below,
(on GPUImageVideoCamera.m)
// just set
-(void)justSetAudioEncodingTarget:(GPUImageMovieWriter*)newValue {
if( newValue == nil ) {
return;
}
addedAudioInputsDueToEncodingTarget = YES;
[super setAudioEncodingTarget:newValue];
}
The following steps is my scenario and I checked out it smoothly worked.
Called VideoCamera's addAudioInputsAndOutputs after the VideoCamera was created.
This is not right before starting the recording. :)
Set MovieWriter to the VideoCamera by justSetAudioEncodingTarget that I made above.

Related

How to get duration of Youtube video without playing the video in Reactjs

I am a newbie in ReactJS and I badly need some help.
So I have a video catalog that only shows the thumbnails of the videos with label and overlay duration. Before I was using React-Player by Pete Cook but I don't want that my video player has share, like and watch later buttons so I decided to not use it and use video-player instead. I just use Image tag for showing thumbnail and I will just pass the Youtube link to the video player if the image is clicked.
Now my problem is that I am having a hard time in getting the video duration. When I was still using React-Player, I can get it after clicking play button (not the result that I want but at least I was able to get the duration). Any solution for this?
Your problem is you're providing a Youtube URL to the video-player library's Player Component which clearly doesn't support it as mentioned here.
I even tried it you'll get no duration value nor the video will be played.
However, if you changed your Youtube link to for example this one https://www.w3schools.com/html/movie.mp4
You'll find that everything is working perfectly and you can get the duration state from the Player's states without even playing the video.
const { player } = this.player.getState();
console.log(player.duration);
I added these two lines to the a method called changeSource mentioned here under Examples title.

URLImages in list renderer disappearing on iOS

I have a custom list renderer that has a logo for a business in it. It has a label Logo_URLImage that has the placeholder image. In my code I get the data and assign HashMaps to the list model, h.put("Logo_URLImage",imageURL); where imageURL is a string that has the absolute URL to the image.
On Android it seems to always work, but most of the testing has been on iOS devices. What happens is that images are updated as you'd expect the first time or two that you run it. A run later on will show blank images (flash the place holder image and then blank) and once that happens images will never come back.
Any thoughts on what might be causing this?
Check that you defined the LogoName map entry. Check that it is unique per image?
Check that it doesn't include special characters that might cause an issue.

videoangular--How to have multiple video players in one screen?

Hi so Im using this angularjs framework "videogular" and have no problem creating a single player, but I dont know how to create multiple players in one screen since apparently each player requires a controller
sample code here:
http://codepen.io/2fdevs/pen/KmDIE
Each player needs a different config file but not a different controller.
Maybe this other answer could be useful:
stop other video that is playing in background on play the new one

How to download images from array to tableviewcontroller in swift?

I have a table view controller with a cell that contains an UIImageView. I also have a NSMutableArray that contains the url's. I want the url's to download the images and place them in the correct order. The NSMutableArray also contains some empty Strings and the cell that it corresponds too I want to have my placeholder image from my image assets.
How can I get it to work? I have also populated each cell with a title and summary but cannot workout how images work.
UPDATE
The code used for the image download. Note the photoLabels contains the array of images. Some of the photos are in the incorrect place once the first placeholder image occurs (It is one index late). Why is it doing that. Does anyone know why. I have println(photoLabels) and all the 50 strings are correct (with some just being "")
If anyone can help that would be great.
let imageURL: String = photoLabels.objectAtIndex(indexPath.row) as String
println(imageURL)
if imageURL == "" {
cell.imageContainer.image = UIImage(named: "placeholder")
} else {
cell.imageContainer.setImageWithURL(NSURL(string: imageURL))
}
return cell
Thanks
This seemingly innocent question actually entails a rat's nest of interesting details. These include:
Use lazy loading of the image, loading them just-in-time, rather than trying to download them up front;
Download the images asynchronously;
While downloading the images as needed, cache them (using NSCache, not NSMutableArray) so that if you scroll back to see some images recently downloaded that you don't have to download them again;
But, in response to memory pressure, make sure to empty the RAM-based cache (but still avail yourself of the persistent storage cache);
If user scrolls quickly down to the 100th row in the table example, make sure that the images for the visible cells don't get backlogged behind the requests for the previous 99 images (nb: you should test your app in suboptimal conditions, e.g. a poor 2G or 3G cellular environment, which can be simulated with the network link conditioner); and
You might want a placeholder image to show until the asynchronously retrieved image is downloaded (or retrieved from the cache).
The bottom line is that this takes a non-trivial amount of effort to do properly. As a result, I'd encourage you to use an existing solution, for example the UIImageView categories that are available from SDWebImage or AFNetworking. Both of these two frameworks offer a nice category for UIImageView that allows you to request the image to be downloaded asynchronously (it's sd_setImageWithURL in SDWebImage; it's setImageWithURL in AFNetworking).

Watin AttachTo: Timeout while waiting for frame document becoming available

I am trying to make WatiN attach to an IE popup window (IE 10).
This popup contains a frameset --> a single frame --> a pdf document.
My goal is to save this pdf to my disk.
Dim winExists = IE.Exists(Of IE)(Find.ByUrl(Function(url) url.Contains("__ADFvDlg")))
If winExists Then 'this evaluates to true
Dim win = IE.AttachTo(Of IE)(Find.ByUrl(Function(url) url.Contains("__ADFvDlg"))) ' Timeout while waiting for frame document becoming available
End If
1) I have tried using the above code inline or in a STA thread
2) When coded inline, its parent thread is also STA
3) I have tried to increase the default timeout to 8 minutes, same result after 8 minutes have passed
There is no other option for me than to parse this particular popup, since it is a site built with Oracle ADF and, apart from the fact that it is A MESS, it is very strange at times...this popup has a URL that somehow works only once. If I try to use it in another window, no pdf is returned. The same happens when I refresh the popup.
I cannot fetch the PDF in the Temporary Internet Files since it is not there (I suppose this is because the website works under SSL).
Any guidelines or solutions even outside WatiN's scope is more than welcome since I've hit a brick wall.
Technologies: VS2012, WPF
Thanks a lot in advance.
I found it easiest when I tried the same thing by making the pop-up show up as a new tab. That way I could attach to it's URL. From there I would use
File.WriteAllText(fileName, responseDownLoad.Content.ReadAsStringAsync().Result);
Where responseDownload will be a HttpResponseMessage

Resources