Find the answer to your Linux question:
Results 1 to 6 of 6
Hi guys! I was trying to stitch some videos using the same commands I used several months ago but can't seem to do it correctly now. Code: jun@jun:~$ cat '/home/jun/dwhelper/One1.mp4' ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Engineer nujinini's Avatar
    Join Date
    Apr 2009
    Posts
    1,272

    Stitching Videos with Cat Not Working


    Hi guys!

    I was trying to stitch some videos using the same commands I used several months ago but can't seem to do it correctly now.

    Code:
    jun@jun:~$ cat '/home/jun/dwhelper/One1.mp4' '/home/jun/dwhelper/Two2.mp4' '/home/jun/dwhelper/Three3.mp4' '/home/jun/dwhelper/Four4.mp4' '/hom e/jun/dwhelper/Five5.mp4' >> '/home/jun/dwhelper/TOTAL.mp4' 
    jun@jun:~$
    Althought the output says I have a file "TOTAL.mp4" and a right click > properties says I have an output of around 200mb plus which is more or less the total.

    I play with totem and just gets the first file.

    Any ideas?

    Thanks!
    nujinini
    Linux User #489667

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,864
    I thought media files had a metadata block at the beginning that described the contents that followed. If you somehow managed to strip the raw data out of two files and stitch them together, you'd still need to recalculate and replace the metadata at the beginning of the file.

    Are you sure you did this with cat? You weren't working with raw .wav or video files in an uncompressed format were you?
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Linux Engineer nujinini's Avatar
    Join Date
    Apr 2009
    Posts
    1,272
    Quote Originally Posted by Roxoff View Post
    I thought media files had a metadata block at the beginning that described the contents that followed. If you somehow managed to strip the raw data out of two files and stitch them together, you'd still need to recalculate and replace the metadata at the beginning of the file.
    I'm not sure if I know how to "recalculate and replace metadata?" hehehe

    Are you sure you did this with cat? You weren't working with raw .wav or video files in an uncompressed format were you?
    Yes I did it with cat. I am sure of that. I am not sure though if what I downloaded from youtube was a "raw file in an uncompressed fromat". It was .mp4.

    I used cat many times but this was to stitch together DVD vobs that I backed up after ripping and compressing them with handbrake. rds,

    regards

    nujinini
    nujinini
    Linux User #489667

  4. #4
    Just Joined!
    Join Date
    Feb 2007
    Location
    LA/Berkeley
    Posts
    33
    A good analogy is to think of the mp4s as books. If you just take the pages of two books out and stick them in a larger binding, you won't have a useful table of contents (or index). Anyone who attempts to rely heavily on the TOC and/or index to read the book will have issues. To create a new book, you'd have to excise the TOCs and indexes from the original two books and write new ones for your new combined book ("recalculate and replace them"), due to the fact that it now has different page numbers, a different length, etc.
    In this case, your video files are not simply raw video data; there is a block of data at the beginning containing information about the file (compression, different media streams in it, etc) that tells video players how to interpret and play back the file. If that block of data is corrupt, you'll likely have trouble playing the file. By combining the files with cat, you've changed the contents of the file and the original metadata block at the beginning of the file is now inaccurate.
    Cat alone obviously doesn't recompute this metadata block, so you're best bet is probably finding some utility which is meant to combine mp4 files specifically.

  5. #5
    Linux Newbie arespi's Avatar
    Join Date
    May 2011
    Location
    Monterrey , Mexico
    Posts
    141
    As far as I know, joining two video files with works only for a certain types of files. I have used it with MPG, but i didn't work for me with MP4.

  6. #6
    Linux User Krendoshazin's Avatar
    Join Date
    Feb 2005
    Location
    London, England
    Posts
    471
    See if Mencoder can do the job:

    Code:
    mencoder -oac copy -ovc copy file1 file2 file3 -o final_movie.mpg

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •