Joining two files together

I'm kinda new to Java, but i'm trying to create a program which joins 2 files together. It works fine with .txt files, but when i try to join two .wmv files, only the one it processes first will show, though the output file will have the size of the two files together. Here's my code for joining them together:
try {
                    JFileChooser location = new JFileChooser();
                    location.showDialog(this, "Save file");
                    File videoout = location.getSelectedFile();
                    OutputStream os = new FileOutputStream(videoout);
                    BufferedOutputStream out = new BufferedOutputStream(os);
                    InputStream is = null;
                    BufferedInputStream in = null;
                    ListIterator pathsIterator = paths.listIterator();
                    while(pathsIterator.hasNext()) {
                        File part = new File(pathsIterator.next().toString());
                        is = new FileInputStream(part);
                        in = new BufferedInputStream(is);
                        int line;
                        while((line = in.read()) != -1) {
                            out.write(line);
                    in.close();
                    out.close();
                    JOptionPane.showMessageDialog(this, "Done");
                } catch(IOException io) {
                    System.out.println("IO: " + io);
                }Any idea what i'm doing wrong?
Thanks

Just because you put 2 files in the same file doesn't mean some application can understand that it's 2 files in 1. Meaning, the player of the merged WMV can't know that there's 2 files and that it should play both back to back. You have to read the WMV files knowing the WMV format and then generate 1 file that combines the 2, which typically would include updating header information in the file. Java's I/O classes are not going to provide that sort of thing for you.

Similar Messages

  • Joining Video Files together with MiniME

    I'm trying to solve the problem of joining together two video files, and came across this jar:
    http://java.sun.com/products/java-media/jmf/2.1.1/solutions/MiniME.html
    I've extracted the source files, and now I'm trying to run MiniME as per the instructions, but with no success.
    Ideally, I'd like to be able to do it without using the GUI but the source isn't so simple and isn't commented at all - that aside, I'd just like to get it to work so that I can succesfully join video files in java!
    Can anybody help me out here?
    Cheers,
    James

    Just because you put 2 files in the same file doesn't mean some application can understand that it's 2 files in 1. Meaning, the player of the merged WMV can't know that there's 2 files and that it should play both back to back. You have to read the WMV files knowing the WMV format and then generate 1 file that combines the 2, which typically would include updating header information in the file. Java's I/O classes are not going to provide that sort of thing for you.

  • Join two sites together

    Hi, i have two dynamic websites each connecting to two
    separate databases via separate connections. I have tried merging
    the two sites into one, but i get a problem because the database
    connection for one of the sites dont work after i join them. Can
    anyone please tell me the best way to join two dynamic sites
    together, so that both their databases work.
    thank you

    the best way to do it is to create a DSN connection but you
    have to make
    sure that they are on the same server
    if both the websites are on the same server that it can be
    easily done using
    DSN connection

  • How to join two arrays together?

    I have the following type
        type TVarcharArr is table of varchar(4000) index by binary_integer;I have a procedure that passes in two separate arrays as:
        p_account_number                 in TVarcharArr,
        p_product_system_code          in TVarcharArrThese arrays are related (they will have the same number of elements), the contents would be as follows:
        Account Number    Product System Code
        123                      ABC
        456                      DEF
        789                      GHII can use TABLE(CAST to turn each of these arrays into a table, but how do I join these two arrays together so that they become a single table with two columns? Or if I CAST them as TABLEs, how can I join these two tables together - is there some way of using the index to facilitate the join?
    Cheers
    Richard

    You are right, I do need to convert the arrays first to use TABLE(CAST, and I do have my concerns about the use of rownum.
    Here's the test case I built to test what I'm doing, incorporating the rownum solution:
    declare
        type TVarcharArr is table of varchar(4000) index by binary_integer;
        v_arr   TVarcharArr;
        v_tab  tchartab := tchartab();
        v_arr2   TVarcharArr;
        v_tab2  tchartab := tchartab();   
    begin
        v_arr(1) := 'ABC';
        v_arr(2) := 'DEF';
        v_arr(3) := 'GHI';
        v_arr2(1) := '123';
        v_arr2(2) := '456';
        v_arr2(3) := '789';   
        v_tab.extend(v_arr.Count);   
        for i in v_arr.first .. v_arr.last
        loop
            v_tab(i) := v_arr(i);
        end loop;   
        v_tab2.extend(v_arr2.Count);   
        for i in v_arr2.first .. v_arr2.last
        loop
            v_tab2(i) := v_arr2(i);
        end loop;   
        for rec in (with w_acct as
                    (select rownum rn, a.column_value acol
                    from table(cast(v_tab as tchartab)) a
                         w_prod as
                    (select rownum rn, b.column_value bcol
                    from table(cast(v_tab2 as tchartab)) b
                    select acol,bcol
                    from w_acct a,
                         w_prod b
                    where a.rn = b.rn) loop
            DBMS_OUTPUT.PUT_LINE ( 'rec = ' || rec.acol || '|'|| rec.bcol );
            null;
        end loop;
    end;It does return the correct result - but can it be trusted to be consistent - does the rownum in an array suffer the same problems as the rownum from a regular select? I'm guessing it's too risky to find out.
    In essence, I'm getting two arrays and I'm trying to join them together so that I can CAST them as a table. (And I know the real question is why isn't it just one array of records with two elements - but sometimes you have to work with what you're given)

  • Join two images together in PS7.

    Hi folks I am exasperated by PS 7 again.
    Someone has emailed me an old document in two sections (JPGs) and I want to "knit" them together again to make one document (JPG).
    I've spent ages in PS7 trying to do this, to no avail.
    Help, please?

    Hey guys I am back!
    The first time I knitted two images together it worked perfectly. However when I tried it again it did not work.
    What happened....I used Curt's method and expanded the canvas then copied and pasted the second image in to it, the same as  before. However, THIS time image 2 overlapped image 1 and there appears to be no way of dragging it downwards when that happens.

  • Editing two files together for proper aspect ratio output

    hello,
    i have 2 files that are 720 x 480 which i'll edit into one project playing together side by side.
    this will then show on a projector with a native resolution of 1280x800.
    i do not want to crop the sides of two source files by half, but to crop them by a lesser amount to make a wider pairing that will play well with the projector's 16:10 aspect ratio, with no black banding.
    to begin my project: 768x480 (same 16:10 ratio as the projector) is not an option to select as a project starting point. 1280x800 is also not an option, and although the crop is actually perfect in a 1280x720 project, i don't want fcpx to do the upscaling, and i believe the 16:9 aspect ratio would lead to black banding top/bottom when shown on the projector.
    i'm not sure where to begin, any advice would be appreciated,
    thanks.

    Unfortunately, FCPX does not offer any 16:10 project settings. The different resolutions offered for HD formats refer to pixel ratio rather than actual dimensions. A project in FCPX is going to be either 4:3 or 16:9. There are a couple of things you can try, but my recommendation would depend on what program will be used to output the movie to the projector (QuickTime?). The 1280x720 dimensions are the standard 720p resolution and is as close as you will get to your desired resolution. If you are worried about the banding that would occur when displaying a 16:9 file on a 16:10 projector, the easiest solution would be to use the media player to stretch the movie to fill the screen. If you have Compressor you could encode your FCPX output to your desired resolution, but you will still be stretching the image. If you want more assistance provide a little more info, are the soure files 4:3 or 16:9 for example, and I may be able to offer more advice if I know a little more.  

  • Batch Processing and Putting Two files together?

    Hello,
    I'm trying to find out if there is a way, in Photoshop, to automate placing a logo file and border from another file into a set of photos? Basically, I have a folder of, let's say, 4x6 images, and I have a file that has two layers, a thin transparent border layer, and a layer housing the logo. I would like to find out if it's possible to automate the process where I can batch a lot of files to put this file (or the two layers) onto the original image, then save and close and go on to the next file. Any ideas how to accomplish this? Thanks!
    Regards,
    Dave

    Here is a simple script I made a while back that allows you to place one of two different logo files on the image, depending whether the image is upright or horizontal in orientation.
    All you need is to put you two logo files in a folder and tell the script which folder they are in. After that, when you run the script, it will place the appropriate logo file onto you image depending on the orientation. I used "C:\\MyLogoA.tif" and "C:\\MyLogoB.tif" for this script.
    You can run this script from a batch process.
    var doc = app.activeDocument; // This defines the active document
    var width = doc.width.value; // This is the width of the original image
    var height = doc.height.value; // This is the height of the original image
    // Call the placeLogo function
    if(width>height){
    placeLogo("C:\\MyLogoA.tif");
    }else{
    placeLogo("C:\\MyLogoB.tif");
    // This is the placeLogo function
    function placeLogo(path)
    // =======================================================
    var id35 = charIDToTypeID( "Plc " );
    var desc8 = new ActionDescriptor();
    var id36 = charIDToTypeID( "null" );
    desc8.putPath( id36, new File( path ) );
    var id37 = charIDToTypeID( "FTcs" );
    var id38 = charIDToTypeID( "QCSt" );
    var id39 = charIDToTypeID( "Qcsa" );
    desc8.putEnumerated( id37, id38, id39 );
    var id40 = charIDToTypeID( "Ofst" );
    var desc9 = new ActionDescriptor();
    var id41 = charIDToTypeID( "Hrzn" );
    var id42 = charIDToTypeID( "#Pxl" );
    desc9.putUnitDouble( id41, id42, 0.000000 );
    var id43 = charIDToTypeID( "Vrtc" );
    var id44 = charIDToTypeID( "#Pxl" );
    desc9.putUnitDouble( id43, id44, 0.000000 );
    var id45 = charIDToTypeID( "Ofst" );
    desc8.putObject( id40, id45, desc9 );
    executeAction( id35, desc8, DialogModes.NO );
    // =======================================================

  • Batch Combining two files together into one

    hi everyone, first time poster here and i would greatly appreciate any help in my dilemma.
    im trying to batch process images into a single file using a script i got from the link below.
    Ok, my problem....merging two unique files batch Process
    my only issue im having is that i want the new batched file names to retain the foreground image file name.
    right now the batched file name is "file0001.psd", "file0002.psd", and so on.
    thanks for your help,
    Greg

    File Basics:
    The jpg file format does not support layer. You are better off creating your layer file as a PSD and then generate a jpg file.
    The PSD will be the master file for archiving and the JPG the working file.
    Save the script as batchStaks.jsx in the Bridge Start up script folder.
    Bridge >> Preferences >>Startup Scripts >> Reveal My Startup Scripts
    Restart Bridge.
    Create a Bridge stack
    Bridge >> Stacks >> Group as Stack
    Execute the batchStacks.jsx script from the Bridge Tools Menu
    Bridge >> Tools >> Batch Sctacks 2.2.0
    The script will save a layered PSD file in the same folder as the original file.
    The layered PSD file will retain the name of the image behind the thumbnail stack thumbnail.
    You need to experiment in Bridge with the image stack order to get the result you want.
    What I do to create layered file which retains the name of the thumbnail image stack is:
    I create a photoshop action which reverses the layer order.
    Then I have the script run the action while it creates the layered file.
    The result is a layered file that retains the filename of the thumbnail image stack. 
    The limitation is that the script dependes on the action file tho.
    #target bridge 
    @@@START_XML@@@
    <?xml version="1.0" encoding="UTF-8"?>
    <ScriptInfo xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en_US">
         <dc:title>Batch Stack 2.2.0</dc:title>
         <dc:description>The script loads Bridge Stacks as Photoshop layes and returns a layerd PSD file.</dc:description>
    </ScriptInfo>
    @@@END_XML@@@
    app.bringToFront();
    if( BridgeTalk.appName == "bridge" ) {    
        var batchStack = new MenuElement( "command","Batch Srtacks 2.2.0", "at the end of Tools" ); 
    batchStack .onSelect = function () {  
        var stacks = app.document.stacks; 
        var stackCount = stacks.length;
        for(var s = 0;s<stackCount;s++){ 
              var stackFiles = getStackFiles( stacks[s] ); 
              if(stackFiles.length> 1){ 
                   var bt = new BridgeTalk; 
                   bt.target = "photoshop"; 
                   var myScript = ("var ftn = " + psRemote.toSource() + "; ftn("+stackFiles.toSource()+");"); 
                   bt.body = myScript; 
                   bt.send(5); 
        function getStackFiles( stack ){ 
              var files = new Array(); 
              for( var f = 0; f<stack.thumbnails.length;f++){ 
              files.push(stack.thumbnails[f].spec); 
             return files; 
        function psRemote(stackFiles){ 
            app.bringToFront(); 
            var thisDoc = open(File(stackFiles[0])); 
            var Name = decodeURI(app.activeDocument.name).slice(0,-4); 
            thisDoc.layers[0].name = decodeURI(Name);
        for(var a = 1;a<stackFiles.length;a++){ 
            open(File(stackFiles[a])); 
            Name = decodeURI(app.activeDocument.name).slice(0,-4); 
            activeDocument.activeLayer.duplicate(thisDoc); 
            app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); 
            thisDoc.layers[0].name = Name;       
            var psdOptions = new PhotoshopSaveOptions();
            psdOptions.embedColorProfile = true;
            psdOptions.alphaChannels = true;
            psdOptions.layers = true;
            psdOptions.spotColors = true;     
            var name = app.activeDocument.name.replace(/\.[^\.]+$/, '');        
            var path = app.activeDocument.path;
            var saveFile = File(path + "/" + name );
            app.activeDocument.saveAs(saveFile, psdOptions, true); 
            app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);   

  • Can I join two accounts together?

    hey I rejoined Sky - can i merge my old and new accounts? thanks

    There is an answer here from a few years ago, I guess the answer would be the same now:
    http://helpforum.sky.com/t5/Archived-Discussions/Can-I-merge-two-sky-accounts/m-p/74153
    You will need to speak to Sky directly (phone or live chat) for more clarification.

  • How to join two similar layers together?

    Hey all! Please help me out, It is a little thing to do, but I am really stocked at this. How to join two layers together?? For example two Text layers or anything. Pleas can you describe the way to do it and write (if it exist) the shortcut for it?
    Now I know, that layers in AAF can't be joined, there is just a "Pre-Compose". But this function is disabled the FX colone, and I have to have it there.
    In this tut http://www.videocopilot.net/tutorials/shatterize/ he joined two text layers. But with some shortcut so I don't know, how he did it.
    Can anyone help me plz?
    THX for reply

    Lufty09 wrote:
    Yes, but this is disabled the Fx button :/
    Now you need to look up precomposing in the help system. It's all explained there.
    Nesting and precomping are advanced functions and require careful planning or inspired improvisation within the limits of the software. You also need to look up how the rasterization button works in its two operation modes.
    bogiesan

  • Joing two files by Numeric and alpha field.

    I asked this question yesterday and thought it complete. Unfotunately, I don't know SQL as well as I thought I did.  I nedd to link two files together. In the Address Book Master(F0902), I need to link ABAN8(numeric Field) to GBSBL(Alpha Field) in the Account Balances File(F0902).
    I was not sure how to convert the correct field and then how to link them. Below is the SQL that I have built. It is missing the convert and the Link.
    Thanks again, Rick
    SELECT "F0101_Address_Book_Master"."ABAN8_Address_Number", "F0101_Address_Book_Master"."ABALPH_Alpha_Name", "F0101_Address_Book_Master"."ABAT1_Search_Type"
    FROM   "F0101_Address_Book_Master" "F0101_Address_Book_Master"
    WHERE  ("F0101_Address_Book_Master"."ABAT1_Search_Type"='E' OR "F0101_Address_Book_Master"."ABAT1_Search_Type"='X')
    SELECT "F0902_Account_Balances"."GBAN01_Net_Posting_01", "F0902_Account_Balances"."GBFY_Fiscal_Year", "F0902_Account_Balances"."GBSBL_Subledger"
    FROM   "F0902_Account_Balances" "F0902_Account_Balances"
    WHERE  "F0902_Account_Balances"."GBFY_Fiscal_Year"=11

    Not clear what your database is assuming its SQL server
    SELECT "F0101_Address_Book_Master"."ABAN8_Address_Number", "F0101_Address_Book_Master"."ABALPH_Alpha_Name", "F0101_Address_Book_Master"."ABAT1_Search_Type", "F0902_Account_Balances"."GBAN01_Net_Posting_01", "F0902_Account_Balances"."GBFY_Fiscal_Year", "F0902_Account_Balances"."GBSBL_Subledger"
    FROM "F0101_Address_Book_Master" "F0101_Address_Book_Master"
    inner join  "F0902_Account_Balances" "F0902_Account_Balances" on "F0101_Address_Book_Master"."ABAN8" = cast("F0902_Account_Balances" ."GBSBL" as int)
    WHERE ("F0101_Address_Book_Master"."ABAT1_Search_Type"='E' OR "F0101_Address_Book_Master"."ABAT1_Search_Type"='X')
    and "F0902_Account_Balances"."GBFY_Fiscal_Year"=11
    again assuming "F0101_Address_Book_Master"."ABAN8" is in fact an int, change cast to numeric if appropriate
    Ian

  • How to join two MP4 movies with iMovie '11?

    Just after a quick bit of help here.  I'm not a movie making enthusiast so never used iMovie before and never will again most likely.  However I do have 2 mp4 movies about 4 minutes each that I SIMPLY want to join together.
    I've searched and seen reference to dragging the fils into a project then just export as one but for the life of me if import the files I can't seem to find anywhere that provides a view of the two files as thumbnails so I can just drag them to say this one first, this one second.  Join please.  I seem to get streams and streams of individual frames with sliding lines and what not and the best I seem to be able to get is about 4 seconds at a time.  Surely ther MUST be an easy way to just join two movies together without going into advanced frame by frame editing.
    It's not the most intuitive piece of software and I don't have any desire to learn it.  Problem is I am in a **** of rush with this and at the end of a 14 hour image managament day which is making me less than patient with iMovie. 

    QuickTime X can join your two files. Edit menu "Add Clip to End..."

  • Using Sections To Tie Two Rows Together

    I use the section capability to join two rows together.  I have a button that will duplicate the section.  Which on the screen shows perfectly.  However, when you save the file, and open it back up it does not maintain those sections.  It combines them into one.  look at this example:
    TABLE 1
    ROW 1: element1, element2               -- Row 1&2 are group as a section
    ROW 2: element1, element2
    User press the add button:
    Table 1
    ROW 1: element1, element2                -- So when the user press the add button it duplicates the section to add two more rows in order
    ROW2: element 1, element2
    ROW3: element 1, element2
    ROW4: element 1, element2
    The user now saves the form and exits...
    The user lanuches reader and opens the form. they see the follow result...
    ROW1: element1, element2
    ROW3: element1, element2
    ROW2: element1, element2
    ROW4: element1, element2
    I need the section to stay together...  Any suggestions of what can be done?
    Regards

    Uncheck the checkbox for the "Repeat Row for each Data Item" in the Bidning tab for Row2 and Row3 inside the Section.
    You are actually creating a new instance of the section (which includes Row2 and Row3). So this check box should be checked at the Section levl not at the Row level. You have already checked the Section property so remove from Row 2 and Row3.
    Thanks
    Srini

  • How do I join two tables in the same database and load the result into a destination table in a SSIS package

    Hi,
    I have a query that joins two tables in the same database, the result needs to be loaded in a destination DB table.  How do I do this in SSIS package?
    thank you !
    Thank You Warmest Fanny Pied

    Please take a look at these links related to your query.
    http://stackoverflow.com/questions/5145637/querying-data-by-joining-two-tables-in-two-database-on-different-servers
    http://stackoverflow.com/questions/7037228/joining-two-tables-together-in-one-database

  • Linking two switches together.

    hi Guys ,
    quick question in relation to joining two switches together,
    can I link a 2950 switch with a 1000 BASE-SX with a 3560G with 4 SPF ports with fibre and what pitfalls should i look out for .
    Thanks in advance
    Kevin

    Hello,
    So you would like to connect GBIC to SFP, you need Multimode Duplex Fiber Optical cable with SC-LC connectors. If SFP to SFP you need the same cably type with LC-LC connectors.
    http://www.cisco.com/en/US/products/hw/routers/ps341/prod_module_installation_guide09186a00801cc731.html
    http://cisco.com/en/US/products/hw/modules/ps5455/products_data_sheet09186a008014cb5e.html
    bye
    FCS
    Please rate me if I helped.

Maybe you are looking for