VideoHelp Forum
+ Reply to Thread
Results 1 to 12 of 12
Thread
  1. Member
    Join Date: May 2014
    Location: Planet Earth
    Search PM
    Hi guys.

    I'm helping a friend who has video 800 clips from his camera, all with identical video properties and in .mp3 format. I've tried pretty much every video edit program, Sony Vegas (crashes), AVIDemux (crashes), vdubmod (doesn't allow appending mpg files), videoredo (Input stream error: error opening file when saving) so it's getting kinda frustrating

    I've used Windows command line to merge all the files into one big .mpg file, luckily they are numbered in ascending order but the numbering starts in the middle of nowhere so I used this command with wildcard:

    copy /b abc*.mpg merged.mpg

    I have a 11.7gb .mpg file (ironically this is the same size as all 800 split mpg files). It plays back fine in VLC however there is no time across the scroll bar which is probably as the big .mpg is patched by Windows. When I try importing the 11.7gb patched file, the above programs only recognise the first clip in the patched file and most crash when I try importing all 800 files.

    My goal is to merge all the files and finally re-encode the merged file so it can be burned to 2 DVD's. I'm having a hard job completing step 1.

    Any help would be most welcome
    Quote Quote  
  2. Member Cornucopia's Avatar
    Join Date: Oct 2001
    Location: Deep in the Heart of Texas
    Search Comp PM
    Disregarding the fact that .mp3 files ARE CLEARLY NOT video clips (your were probably thinking of .MPG), using Windows' Command Line is the ABSOLUTELY WRONG way to go, and is no surprise at all that most programs have problems with it.

    A valid multimedia container file, such as MPG, has
    A. A single container header
    B. A (usually) single video header
    C. A (usually) single audio header
    D. sectors of elementary video stream interleaved with sectors of elementary audio stream
    E. an Optional "Footer" to B,C, and A, usually having Indexing info.

    Your combined file has 800 A's, 800 B's, 800'Cs and 800 interleaved streams, separated by those other items, plus conflicting/duplicated indexing info.

    The fact that you got it to play back somewhat ok in VLC is just sheer dumb luck on VLC's part.

    The fact is, barring a really cool script for ffmpeg that loads the info from some spreadsheet (which somebody here might be able to do, but I have neither the time nor inclination to do), or using a commercial batch encoder app ($$), I know of NO easy or automated way to do this.

    I guess you could:
    1. Create a script or get an app to batch demux the V & A streams to their elementary/raw files
    2. Try Copy /B and append, in order, all the elementary V streams, and then all the elementary A streams, generating a single large V elementary stream and a single large A elementary stream.
    3. Remux the resulting file(s) to MPG, which should hopefully clean up any weirdness in the aggregate streams.
    4. THEN, re-encode.

    I have got to ask: how long a duration is this combined file supposed to be? And Why didn't your friend's camera just give it to you as less # of larger files?

    Scott
    Last edited by Cornucopia; 13th May 2014 at 23:57.
    "When will the rhetorical questions end?!" - George Carlin
    Quote Quote  
  3. Mpg2cut2 can join multiple MPG files (you can select them all in the file open file dialog) though I don't know if it can handle 800 in a single open. When you open them select the last file first, then shift-click on the first file. That way they'll open in order.
    Quote Quote  
  4. Member
    Join Date: Feb 2014
    Location: Mumbai
    Search Comp PM
    first of all use ffmpeg to do something like this...

    first of all create a text file which contains the list of files to be concatenated ..
    it should be something like this
    Code:
    file '/path/to/file1.mpg'
    file '/path/to/file2.mpg'
    file '/path/to/file3.mpg'
    without single quotes ... if in windows.
    the path may be relative . but i recommend full path.

    then simply use this
    Code:
    ffmpeg -f concat -i mylist.txt -c copy output.mpg
    This worked for me perfectly for merging 10 mkv videos ...
    But the main part here is to type all the 800 files into the txt file ... you might be able to do it quickly using a C or java program..
    and the rest of the task is simple

    ** the source is a video cam so I assume all the videos to be of the same specs
    Last edited by Placebo; 14th May 2014 at 02:51.
    Quote Quote  
  5. Member
    Join Date: May 2014
    Location: Planet Earth
    Search PM
    @Cornucopia - Sorry that was a typo, all files from his cam were in .mpg not .mp3. AFAIK all have identical properties and the combined length is about 3 hours and 10 minutes

    @jagabo Mpg2cut2 opens the first 124 files only, I've tried saving batches of 124 and playing them back and Windows/VLC reports their length as long as the first clip in the compiled video e.g 8 seconds for the first 124 files I joined so I guess this isn't going to be a viable option.

    @Placebo The problem is generating a .txt file with all the file paths on separate lines. I used to have a great app called treeprint in the past but this doesn't work with Windows 7 x64. Just to be sure, the text file needs to look like this right?

    file D:/video/abc541.mpg
    file D:/video/abc542.mpg
    file D:/video/abc543.mpg
    ....
    Quote Quote  
  6. For me works : file 'C:\file_xx.xxx'

    to generate list plain dir /b *.xxx > mylist.txt works ok, all you need to do is adding file 'C:\ ' to listed files (this can be done by automatic replace)

    of course xxx etc is correct name, extension etc - it will be unique for your files
    Quote Quote  
  7. Member
    Join Date: Feb 2014
    Location: Mumbai
    Search Comp PM
    Heyy @ rookieauthor
    I found a fool proof method to generate the mylist.txt file !
    I'll break it up in a few steps.


    STEP 1 : Save the following command in a batch file (assuming you know how to make a batch file in Windows)

    Code:
    dir /b /s *.mpg > mylist.txt




    STEP 2 :


    Now place this batch file inside the folder which has those 800 mpgs
    Also create a new text file named "mylist.txt" in the same folder

    Your folder should look something like this [ I have taken few avi files of my school Get TOgether ... ]


    Run it (or double click it ..)
    If everything goes correctly , then you'll have your 800 mpgs in the txt file.

    In my case the output will be

    Code:
    C:\Users\sandesh\Downloads\Compressed\GTO\GTO 01.avi
    C:\Users\sandesh\Downloads\Compressed\GTO\GTO 02.avi
    C:\Users\sandesh\Downloads\Compressed\GTO\GTO 03.avi
    C:\Users\sandesh\Downloads\Compressed\GTO\GTO 04.avi
    C:\Users\sandesh\Downloads\Compressed\GTO\GTO 05.avi
    C:\Users\sandesh\Downloads\Compressed\GTO\GTO 06.avi
    C:\Users\sandesh\Downloads\Compressed\GTO\GTO 07.avi
    C:\Users\sandesh\Downloads\Compressed\GTO\GTO 08.avi
    C:\Users\sandesh\Downloads\Compressed\GTO\GTO 09.avi
    C:\Users\sandesh\Downloads\Compressed\GTO\GTO 10.avi
    C:\Users\sandesh\Downloads\Compressed\GTO\GTO 11.avi
    C:\Users\sandesh\Downloads\Compressed\GTO\GTO 12.avi
    Now the problem is ffmpeg requires the format to be
    Code:
     file 'D:\Users\sandesh\Downloads\Compressed\GTO\GTO 01.avi'
    (NOTE : we need ' ' because our file names or path names may contain spaces .. so just to be sure ...)

    We will use the Find and replace features of text editors for this ...


    STEP 3 :

    Just find
    Code:
    C:\
    and replace all with
    Code:
    file 'C:\

    NEXT do this :

    find
    Code:
    .mpg
    and replace all with
    Code:
    .mpg'

    Thats it .. move on to


    STEP 4 :
    Code:
    ffmpeg -f concat -i mylist.txt -c copy output.mpg
    here mylist.txt means the absolute path ... relative path wont work here. Use " " if needed


    --- If you have any doubts, feel free.
    Last edited by Placebo; 14th May 2014 at 07:46. Reason: grammer ..
    Quote Quote  
  8. Member
    Join Date: May 2014
    Location: Planet Earth
    Search PM
    Placebo, thanks you're a diamond. I've remoted into my PC at home from work and have started ffmpeg, its constantly scrolling giving the below errors:

    [mpeg @ 00000000055fe720] buffer underflow st=1 bufi=37828 size=66833
    [mpeg @ 00000000055fe720] buffer underflow st=1 bufi=39865 size=66833
    [mpeg @ 00000000055fe720] packet too large, ignoring buffer limits to mux it
    [mpeg @ 00000000055fe720] buffer underflow st=1 bufi=39865 size=66833
    [mpeg @ 00000000055fe720] buffer underflow st=1 bufi=41902 size=66833
    [mpeg @ 00000000055fe720] packet too large, ignoring buffer limits to mux it

    etc. I guess it's going to take a while to get through all 800 clips. Should these errors be of any concern?
    Quote Quote  
  9. Member
    Join Date: Feb 2014
    Location: Mumbai
    Search Comp PM
    @rookieauthor
    Looks like a warning , If it appears for a brief period , then just ignore it...
    This buffer underflow warning is generally related to incompatibility between a container and video codec . Which codec are you using?
    Quote Quote  
  10. Member
    Join Date: May 2014
    Location: Planet Earth
    Search PM
    I was getting the buffer underflow/packet too large errors 10x per sec. ffmpeg finally finished what it was doing and printed the following in command line

    frame=346485 fps=151 q=-1.0 Lsize=12059700kB time=03:04:25.47 bitrate=8928.0kbit
    s/s
    video:351524kB audio:11641175kB subtitle:0kB other streams:0kB global headers:0k
    B muxing overhead: 0.558686%
    The output video it has made is 2h 47m, some 17 minutes short of the length of the total combined clips. The clips codec is reported as follows my VLC:

    Stream 0
    Type: Audio
    Codec: A52 Audio (aka AC3) (a52)
    Channels: Stereo
    Sample rate: 48000 Hz
    Bitrate: 256 kb/s

    Stream 1
    Type: Video
    Codec: MPEG-1/2 Video (mgpv)
    Resolutiion: 720x576
    Frame rate: 25
    Decoded format: Planar 4:2:0 YUV
    Quote Quote  
  11. Member
    Join Date: May 2014
    Location: Planet Earth
    Search PM
    The video produced by ffmpeg unfortunately doesn't play on most my media players apart from VLC. In VLC, is starts and freezes on the first frame, audio is muffled and video stops at about 7 seconds. I think the clips may need re-encoding. I've ran a few clips through GSpot which gives the following as the codec used:

    Container
    DVD "VOB" format
    MPEG-2 Program Stream << { 1 vid, 1 aud }
    Sys Bitrate: 10080 kb/s VBR

    Video
    Codec: MPEG2
    FPS: 25
    WxD: 720 x 576
    Average birate: 8804

    Audio
    Codec: AC3
    Info: 0xbd[0x80]:48000Hz 256 kb/s tot , stereo (2/0)
    Reading up on Google about the constant buffer underflow & packet too large errors, I think that I have to add some additional info to the command line but I don't have a clue I need to re-encode all the clips which total 11.7GB so I can fit them onto 2x 4.37GB DVD's. Is there any way I can specify this in the command line? This is how it looks currently

    ffmpeg -f concat -i d:\video\mylist.txt -vcodec copy -acodec copy -c copy D:\video\output.mpg
    Quote Quote  
  12. Member Cornucopia's Avatar
    Join Date: Oct 2001
    Location: Deep in the Heart of Texas
    Search Comp PM
    Did you ever try concatenating the raw streams like I suggested?

    Scott
    "When will the rhetorical questions end?!" - George Carlin
    Quote Quote