w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Concat video files of different resolutions using FFmpeg
For merging videos you need to work with the same resolution, you should scale the 640x480 video or compress the 1280x720, it is up to you. I would recommend you compress the bigger one it is faster. Moreover, for merging videos you need a media file with audio and video part. You can create a silence audio with the same duration of your video and after you can add it to your video. Videos should be merged with audio. ffmpeg -ar 48000 -t 60 -f s16le -acodec pcm_s16le -i /dev/zero -ab 128K -f mp2 -acodec mp2 -y silence.mp2 ffmpeg -i video_without_audio.mpg -i silence.mp2 video_to_merge.mpg

Categories : Android

Avoid heroku R14 error with large create loop
Some ideas that may help: Since you are just pulling name from ReferenceThings, don't grab the full object and then just grab the name. Instead do something like this: reference_things = ReferenceThings.where(some_criteria).pluck(:name) That will do a better query grabbing just the names and give you an array. Much cheaper memory wise. I noticed you are putting all the AssociatedThings you are creating into an array as you go. If you don't actually need an array of them then just creating them will be better. If you do need them, depending on what you need them for you could create them all and then query the database to grab them again and loop over them with find_each which will grab them in batches.

Categories : Ruby On Rails

Cutting the videos based on start and end time using ffmpeg
You probably do not have a keyframe at the 3 second mark. Because non-keyframes encode differences from other frames, they require all of the data starting with the previous keyframe. With the mp4 container it is possible to cut at a non-keyframe without re-encoding using an edit list. In other words, if the closest keyframe before 3s is at 0s then it will copy the video starting at 0s and use an edit list to tell the player to start playing 3 seconds in. If you are using the latest ffmpeg from git master it will do this using an edit list when invoked using the command that you provided. If this is not working for you then you are probably either using an older version of ffmpeg, or your player does not support edit lists. Some players will ignore the edit list and always play all o

Categories : Linux

Playing videos on iPhone after video conversion using ffmpeg
I just wrote a blog post that covers encoding_h264_for_ios that shows examples of h.264 encoding that do and do not work on iOS hardware. The specific command line that I use is this: ffmpeg -y -i INPUT.mov -c:v libx264 -pix_fmt yuv420p -preset:v slow -profile:v baseline -crf 23 OUTPUT.m4v If I were you, I would try to encode the videos on the command line and test them on iOS hardware without the web interface. Then, go step by step with specific command line options until you found the one that was breaking the iOS playback.

Categories : Android

Android encode video with ffmpeg while it is still recording
Your real time requirement may lead you away from ffmpeg to webrtc and or to html5. some resources; http://dev.w3.org/2011/webrtc/editor/getusermedia.html (section5) https://github.com/lukeweber/webrtc-jingle-client ondello .. they have api rather than going native and trying to get at the video stream or getting at the framebuffer to acquire an xcopy of what is in the video buffer, and to then duplicate the stream an manage a connection (socket or chunked http), you may want to look at api type alternatives....

Categories : Android

Create class from string in c++ to avoid large switch statement?
Yes, use a map: struct Base { virtual ~Base(); }; struct Factory { enum Types { ThingA, WidgetB, GadgetC }; typedef Base * (*MakerFunction)(); static std::map<Types, MakerFunction> makers; static std::unique_ptr<Base> create(Types t) { return { makers[t]() }; } }; Now for every object derived from Base you just have to insert a suitable creation function into the map Factory::makers. Example: struct Thing : Base { static Base * create() { return new Thing; } }; // somewhere Factory::makers[Factory::ThingA] = &Thing::create; (Personally, I'd probably use unique_ptrs in all the interfaces, and maybe have some sort of self-registration mechanism with an auxiliary class that does the registration in a constructor. You'd also want

Categories : C++

Encode Android AudioRecord raw pcm data to other format using ffmpeg
You can create a .wav file with your data in bytes and later convert this audio file with your image directly in a video. 1 image + 1 audio file = 1 video

Categories : Android

Encode x264 video with ffmpeg for Android with starting offset
Upgrading to ffmpeg 1.2.1 fixed the compatibility issue. After that, my Android phone was able to play the videos just fine. The -ss option is trickier than it at first looks. It has a different meaning based on whether it is before or after -i. It turns out, to make it work, you have to use both. You put the main offset before -i, which makes ffmpeg skip to that point in the stream. But, then you also need a small non-zero offset AFTER -i to make it seek to that point within the stream so audio and video will be in sync. For reference, the final working command is: ffmpeg -ss 00:03:52.00 -i in.mp4 -ss 0.1 -t 01:28:33.00 -c:v libx264 -preset medium -crf 20 -maxrate 400k -bufsize 1835k -c:a libvorbis -sn out.mkv

Categories : Android

ffmpeg commands to concatenate different type and resolution videos into 1 video and can be played in android
You can use concat to append all the videos one by one after converting them to a single format. You can also use the below command to convert differently formatted video to one format: ./ffmpeg -i 1.mp4 -acodec libvo_aacenc -vcodec libx264 -s 1920x1080 -r 60 -strict experimental 1.mp4 Convert everything to mp4 and then follow the instructions given in the link above. This will enable you to join all the videos in a single file.

Categories : Android

how to avoid reaching max size of varchar2 in concat with update
You should create a stored procedure that you will call to update that field. It will check what the new size will be after the update, and if it is too large then perform whatever action you need to (ie. add to archive table, trim off existing data, etc.).

Categories : SQL

How to avoid auto-playing Youtube videos in UIWebView
Here is the code to create an load an embedded video in iPhone using iFrame NSString *yourURL = @"http://www.cloudstringers.com:14556/ingCloud/users/400010003/mp4_320p/efda2f8a618be8e4a36b81d31251752820130710115909.mp4"; NSString *embedHTML =[NSString stringWithFormat:@" <html><head> <style type="text/css"> body { background-color: #666666; padding:%f %f %f %f; color: blue; } </style> </head><body style="margin:0"> <iframe height="%f" width="%f" title="YouTube Video" class="youtube-player"

Categories : Iphone

How do you test if 2 large videos are identical?
I would start with file length (quick and dirt), continue with MD5 and finish with checking frames. Quick and easy. Of course if you get an edited file it will give you false negatives, but then it will probably give you false negatives for MD5 and probably even with checking even frames; preventing false negatives due to edition would be so computationally expensive that it is probably better to just ignore them.

Categories : Java

Upload large videos to Facebook with iOS SDK
I had to construct my NSData for the video parameter like so: videoData = [NSData dataWithContentsOfURL:url options:NSDataReadingMappedAlways error:&error]; I also had to change this method in FBRequestConnection.m and things started working: // // Generates a URL for a batch containing only a single request, // and names all attachments that need to go in the body of the // request. // // The URL contains all parameters that are not body attachments, // including the session key if present. // // Attachments are named and referenced by name in the URL. // - (NSString *)urlStringForSingleRequest:(FBRequest *)request forBatch:(BOOL)forBatch { [request.parameters setValue:@"json" forKey:@"format"]; [request.parameters setValue:kSDK forKey:@"sdk"]; NSString *token = reques

Categories : IOS

Iterating through table to use as parameters in function to create large new table
"Computer_Type, Jul_Num, Aug_Num, and Sep_Num" One-column-per-month works for reporting or a data-entry interface, but you are going to drive yourself absolutely bonkers if you actually store the data that way. If you have the means to go back and change that table to "Computer_Type, Year, Month, Num" or "Computer_Type, Date, Num", then you should do that first.

Categories : SQL

concat 2 dimensional cell array with strings to one large string in matlab
try using sprintf >> error(['please correct elements with IDs: ', sprintf('%s, ', myCellArray{:}) ] ) results with ??? please correct elements with IDs: M1, M36, M129,

Categories : String

Json encode parameters issue
You might looking for something like this: echo json_encode(array($status, $title, $message)); or, as others suggested, like this: json_encode(array("status"=>$status, "title"=>$title, "message"=>$message))

Categories : PHP

how do i decode/encode the url parameters for the new google maps?
Try this. function URLtoLatLng(url){ this.lat = url.replace(/^.+!3d(.+)!4d.+$/, '$1'); this.lng = url.replace(/^.+!4d(.+)!6e.+$/, '$1'); return this; } var url = new URLtoLatLng('https://www.google.com/maps/preview#!data=!1m4!1m3!1d189334!2d-96.03687!3d36.1250439!4m21!3m20!1m4!3m2!3d36.0748342!4d-95.8040972!6e2!1m5!1s1331-1399+E+14th+St%2C+Tulsa%2C+OK+74120!2s0x87b6ec9a1679f9e5%3A0x6e70df70feebbb5e!3m2!3d36.1424613!4d-95.9736986!3m8!1m3!1d189334!2d-96.03687!3d36.1250439!3m2!1i1366!2i705!4f13.1&fid=0'); console.log(url.lat+' '+url.lng);

Categories : Google Maps

How to concat a number with "Kg" using Jquery. I want to concat the TotalWeight field with unit "Kg"
$(document).ready(function () { $("tr.item").each(function () { var weight = $(this).find('td.Weight').text(); // you left out the quotes and the closing paran var unit = "Kg"; $("#TotalWeight").text(weight + unit); }); }); jsFiddle DEMO

Categories : Javascript

How to avoid large if statements?
OK, my C# is a little rusty, but can't you use method overloading to achieve this? I.e. define multiple methods public GetReportLogic(Report1 someReport1, Report1 someReport2) public GetReportLogic(Report1 someReport1, Report2 someReport2) public GetReportLogic(Report2 someReport1, Report2 someReport2) ... with different implementations for different arguments? You could also have a method called, say, combine(Report r) defined in your Report classes and then each Report defines the way it is combined with different other reports.

Categories : C#

Android FFMPEG: Could not execute the ffmpeg from Java code
Do you have root on the device? Mount '/data' and then enter your same 'ffmpeg' command in the shell and see whether the error is the same. Try using the shell to test out different command expressions. Try 'ffmpeg' alone and with just one input file. See whether those commands produce expected output. My wild guess would be that there is an issue with calling 'ffmpeg.main()' that relates to the details of your build.

Categories : Android

Is there another way to avoid duplication of large hashable objects?
If you don't need to be able to efficiently retrieve a canonical copy of an object given a different copy, you can just use a set: s = set() s.add(3) s.add(3) # s only has one 3 in it If you do need to be able to efficiently retrieve canonical copies of objects, don't store them by the hash value - that'd be horribly broken. Just use the hashable directly. class Interner(object): def __init__(self): self._store = {} def canonical_object(self, thing): """Returns a canonical object equal to thing. Always returns the same result for equal things. """ return self._store.setdefault(thing, thing) With the weakref module, you can improve this to not keep a canonical object if the client code lets go of it, just like the built-in intern func

Categories : Python

How to avoid Request Entity Too Large 413 error
php.ini has a setting called post_max_size, which is set to 8M by default (on Ubuntu at least). Consider increasing that value if you are posting a lot of data.

Categories : PHP

create multiple movie thumbnails using ffmpeg (one at a time) failing
doh! really dumb on my part. I was using the same file name for each thumbnail and there was a dialog coming up in the command line asking if I wanted to overwrite my existing thumb image. when I changed the filename to be dynamically created, everything is peachy.

Categories : C#

Node.js concat array after async.concat()
Instead of callback(dialog);, you want callback(null,dialog); because the first parameter to the callback function is an error object. The reason that console.log(arguments) is getting called after the first iteration is because async thinks an error occurred.

Categories : Javascript

carrierwave - create thumb for pictures and videos in same uploader
Your code looks like the carrierwave generated uploader class and if I understand your question correctly, you are looking for a way to restrict the type of file that can be turned into a thumbnail. You can whitelist the types of files the uploader class will accept - so in the uploader class where your :thumb method is located include the following : # Add a white list of extensions which are allowed to be uploaded. # For images you might use something like this: def extension_white_list %w(jpg jpeg gif png) end

Categories : Ruby On Rails

Building FFMpeg Error in IOS6.1 unable to create an executable file
You are using... --cc=/applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc That's wrong for armv7, you should be doing... --cc=/applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1 Change the above to whatever arm-apple-darwin10-gcc-x.x.x version you have that bin folder. As well, change the gas-preprocessor's target compiler to the same. --as='gas-preprocessor/gas-preprocessor.pl /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1' Additionally, don't put an -arch armv7 in your --extra-cflags, you don't need it and you may get an error: unrecognized command line option "-arch"

Categories : Iphone

(PHP) How to avoid scientific notation and show the actual large numbers?
You can use standard bc_math library to handle operations with large numbers. Please, note, that in this case your numbers will be represented as strings, but library provides specific methods for operations under such strings.

Categories : PHP

How can i avoid output parameters while doing backtracking?
As far as I know, output parameters is a good practice depending on what you're doing. That's what pointers or references are for. And that's why java or C# uses references on objects by default. Better performances, easier to use, etc etc. Edit: In case you really do want to do that though, you can use a const reference as an output parameter. As long as it's a const reference, it will be kept alive even though the referenced object's destructor was called in the code. You can can also define the copy, move constructors properly (meaning you need to create a wrapper class over the lists) as you said earlier.

Categories : C++

How to avoid using multiple "if then" for checking parameters?
If parameters are all variables (it's not in array or something), you can make a function and write change_or_let_it_be( &param1, value ); change_or_let_it_be( &param2, value ); change_or_let_it_be( &param3, value ); and there you have only one if (in function) and a lot of calls. Better would be to store it in some structure (array, list etc) and avoid calling this function 20 times.

Categories : C

PartialView to create a select box: How to Html.Encode Output?
You don't need to manually Html.Encode because Razor secure by this manner. This means that Razor HTML encodes every string what you write to the output with the @ sing. So you can just safely write @value.Value. By the way the effect what you are seeing is the case of the double encoding because you first encode for text with Html.Encode and then Razor encodes the already encoded text for the second time when you write it out with @Html.Encode(value.Value).

Categories : Asp Net Mvc

YouTube JavaScript API - Play videos without having to create Iframes on mobile phones?
the fiddle. Here is the code: <div id="timerText"></div> <iframe id="player" width="420" height="315" src="http://www.youtube.com/embed/TP2iRzzamCk" frameborder="0" allowfullscreen></iframe> <body > <script> /** * @author Rob W <gwnRob@gmail.com> * @website http://stackoverflow.com/a/7513356/938089 * @version 20120724 * @description Executes function on a framed YouTube video (see website link) * For a full list of possible functions, see: * https://developers.google.com/youtube/js_api_reference * @param String frame_id The id of (the div containing) the frame * @param String func Desired function to call, eg. "playVideo" * (Function) Function to call when the player is ready.

Categories : Javascript

OpenCV won't open some videos of many videos of the same format
I understand that this is a crash? If so, the answer is pretty simple: there's a bug in codec, from the name of the DLL I think that's ffmpeg H264 codec. You should try to update it, or just avoid it.

Categories : C++

how can threshold error to avoid in large list (over 200k items) of sharepoint 2010
You need to use pagination in your fecthes and make sure if you are filtering to setup proper indexes in your columns Have a look at this article on MSDN: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spquery.listitemcollectionposition.aspx This snippet will iterate your list in batches of 10: using (SPWeb oWebsiteRoot = SPContext.Current.Site.RootWeb) { SPList oList = oWebsiteRoot.Lists["Announcements"]; SPQuery oQuery = new SPQuery(); oQuery.RowLimit = 10; oQuery.Query = "<OrderBy Override="TRUE">" + "<FieldRef Name="FileLeafRef" /></OrderBy>"; int intIndex = 1; do { Response.Write("<BR>Page: " + intIndex + "<BR>"); SPListItemCollection collListItems = oList.GetItems(oQuery); f

Categories : Sharepoint

javascript concat() , want to concat 5 different value of string
If your problem always involves 5 numbers, you could simply use 111110-num2. E.g., 111110-12345=98765. To solve the issue for a dynamic amount of numbers, you could make the number of 1s depend on how long the entered number is.

Categories : Javascript

How do I avoid Delphi interpreting special characters as parameters in SQL?
You should put something like this: sqlString := 'SELECT * FROM Table1 WHERE Name LIKE ''`1234567890-=]['''';/.,<>?:"{}|+_)(*&^%$#@!~%'' '; FSQLQuery.ParamCheck := False; //<<It MUST be prior than SetSql. FSQLQuery.SQL.Clear; FSQLQuery.SQL.Add( sqlString ); FSQLQuery.Open;

Categories : SQL

How to retrieve large sets of data accross multiple tables and avoid a looping queries
Assuming your 7 tables are linked by ids, do something like this First query 'SELECT * FROM table_a WHERE a_id IN (12,233,4545,67676,898999)' // store the result in $result_of_first_query Then do a foreach and pick the ids you want to use in the next query in a comma separated variable (csv) foreach($result_of_first_query as $a_row_from_first_table) { $csv_for_second_query = $csv_for_second_query.$a_row_from_first_table['b_id'].","; } $csv_for_second_query = trim($csv_for_second_query,", "); // problem is we will have a lot of duplicate entries $temp_arr = array(); // so lets remove the duplicates $temp_arr = explode(",",$csv_for_second_query); // explode values in array $temp_arr = array_unique($temp_arr); // remove duplicates $csv_for_second_query = implode(",",$temp_arr); /

Categories : Mysql

Stored procedure with large number of parameters
According to this link : http://msdn.microsoft.com/en-us/library/ms143432.aspx , you can have up to 2100 parameters. So this won't be a problem. In term of performance, it'll take extra processing to extract each node from the XML, but it certainly gives more flexibility (and readability) if you'd like to produce dynamics inserts (even if it could be done with standard parameters, with a bit more work I guess).

Categories : Sql Server

Trouble with using csv on large data set to separate parameters
Your csv file has multiple spaces between items. delimiter=' ' causes the reader to regard each space as delimiting a new column. This is why the rows have so many "extra" columns. Use skipinitialspace=True to cause whitespace immediately following the delimiter to be ignored. This will eliminate the bogus extra columns. import Tkinter, tkFileDialog import csv #Choose the file that you want to read from root = Tkinter.Tk() root.withdraw() file_path = tkFileDialog.askopenfilename() with open(file_path , 'rb') as current_file: reader = csv.reader(current_file, delimiter= ' ', skipinitialspace=True) with open('newdata.txt','wb') as output_file: out = csv.writer(output_file) for row in reader: out.writerow(row) print

Categories : Python

Mission : Create a connection with a list of videos and a canvas make them plays 1 by 1, without stops, no click function, ended AddEventListener
In order to make a player that can play videos continously you need to implement some sort of double-buffering at load level (I'll demonstrate later). But there are some issues in the code as it is - myVideo.src = "videos/80s_Mix_II-700.mp4"; myVideo.src = "videos/80s_Mix_II-700.webm"; myVideo.load(); This will simply override the source property. And setting the source will automatically start loading the video. The proper way to check for video support is using the method canPlayType like this: /// which format can we play? if (video.canPlayType("video/mp4").length > 0) { video.src = urlToMP4; } else if (video.canPlayType("video/webm").length > 0) { video.src = urlToWEBM; } else { video.src = urlToOggOrSomeOtherSupportedFormat; } The problem though with canPla

Categories : HTML

Maintaining large data structure (objects) in function parameters?
AFAIK Java and Scala both use references not actual values. So what you are passing around is never a copy of your structure but a copy of a reference to your structure. You will need to ask yourself these questions if you work with .Net, typically C#, because .Net, like native C++, supports two semantics for object storage: value and reference.

Categories : Java



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.