VideoHelp Forum
+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 31 to 44 of 44
Thread
  1. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    The GUI shown in the images is my GUI I am writing, and yes it will split, join, merge, crop, pad, play, preview, sync (visually or audibly), resize, deblock, blur, color adjust(increase/decrease), and more. It is a work in progress so I correct and change as needed when I encounter a problem.

    Document (DOCX) for some of the features is at https://files.secureserver.net/0s1H0CP5f5WZAc

    You are right in that some Mpeg and MP4 will join one way while other formats and combinations like MP4(video,audio,subtitle) will not so I built in these filters. The combining problem of MP4's was a problem several of my friends had as they tried to Join their 'LEGAL' digital versions of movies that were on a 2 sided DVD. I added this feature for that reason.

    The bottom line is the method I suggested works and that is what you asked for. If you have other movie formats or wish to do several at a time then the method must be more complicated or written specifically for that.

    All the methods suggested above well beautifully in some instances but cause unwanted problems (as does mine) in other situations such as recoding (if you do not wish), changing formats (if you do not want), wrong aspect (if program specifics set wrong). etc.

    I am hoping my utility when completely stable will handle generic uses that can be accomplished by clicking the Exceute button in the right hand pane of my example) or you can change the ffmpeg parameters if you are familiar in the upper window of the right hand panel. This will allow for using and just requesting a modification if problems arise.

    Anyway, I'm getting long winded from all the Thanksgiving Turkey I ate but the command line will work for what you wanted to do. I use my utility now to arrive at the correct command line that works for most of my uses.

    Click image for larger version

Name:	ScreenHunter_131 Nov. 28 14.28.jpg
Views:	237
Size:	46.8 KB
ID:	28888Click image for larger version

Name:	ScreenHunter_131 Nov. 28 14.30.jpg
Views:	1959
Size:	56.1 KB
ID:	28889

    UPDATE: Just tried WMV!/2 and WMA1/2 WMV videos and they join with the command line/Text file I suggested earlier. They MUST be complete files formatted correctly. As mentioned earlier, if it is a clip that is just cut out without rebuilding, it most likely will need reencoded first.
    Last edited by Budman1; 28th Nov 2014 at 15:39.
    Quote Quote  
  2. Member
    Join Date
    Feb 2015
    Location
    forgot
    Search PM
    Originally Posted by Budman1 View Post
    UPDATE: EXAMPLE WRONG WILL POST CORRECT LATER... SORRY about that.

    Correct method would be to be sure only video/audio present and use the concat method with file list. Make a text file with a file similar to this and give it a name such as Filelist.txt:

    file 'C:\Users\Bud\Desktop\[dp]Manjandani-1_Extract_1.mp4'
    file 'C:\Users\Bud\Desktop\[dp]Manjandani-1_Extract_2.mp4'

    Then concat with:
    ffmpeg -f concat -i FileList.txt -c copy "C:\Users\Bud\Desktop\_Joined_2.mp4"
    it's the same as "avidemux" works
    I try 1.mp4 + 2.mp4 but part two (2.mp4) in output.mp4 without video, only audio... (I tried mp4box, avidemux, ffmpeg)

    1.mp4:
    Code:
    General
    Format                                   : MPEG-4
    Format profile                           : Base Media
    Codec ID                                 : isom
    File size                                : 610 MiB
    Duration                                 : 39mn 53s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 2 139 Kbps
    Writing application                      : Lavf55.48.100
    
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L3.1
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 39mn 53s
    Bit rate                                 : 1 980 Kbps
    Width                                    : 1 280 pixels
    Height                                   : 720 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Constant
    Frame rate                               : 25.000 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.086
    Stream size                              : 565 MiB (93%)
    Writing library                          : x264 core 142
    Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=8 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=1980 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
    
    Audio
    ID                                       : 2
    Format                                   : AAC
    Format/Info                              : Advanced Audio Codec
    Format profile                           : LC
    Codec ID                                 : 40
    Duration                                 : 39mn 53s
    Duration_LastFrame                       : -18ms
    Bit rate mode                            : Variable
    Bit rate                                 : 152 Kbps
    Maximum bit rate                         : 192 Kbps
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 44.1 KHz
    Compression mode                         : Lossy
    Stream size                              : 43.4 MiB (7%)
    2.mp4:
    Code:
    General
    Format                                   : MPEG-4
    Format profile                           : Base Media
    Codec ID                                 : isom
    File size                                : 612 MiB
    Duration                                 : 40mn 2s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 2 138 Kbps
    Writing application                      : Lavf55.48.100
    
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L3.1
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 40mn 2s
    Bit rate                                 : 1 980 Kbps
    Width                                    : 1 280 pixels
    Height                                   : 720 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Constant
    Frame rate                               : 25.000 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.086
    Stream size                              : 567 MiB (93%)
    Writing library                          : x264 core 142
    Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=8 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=1980 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
    
    Audio
    ID                                       : 2
    Format                                   : AAC
    Format/Info                              : Advanced Audio Codec
    Format profile                           : LC
    Codec ID                                 : 40
    Duration                                 : 40mn 2s
    Bit rate mode                            : Variable
    Bit rate                                 : 152 Kbps
    Maximum bit rate                         : 192 Kbps
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 44.1 KHz
    Compression mode                         : Lossy
    Stream size                              : 43.5 MiB (7%)
    is there any way to join 1.mp4 and 2.mp4 without re-encoding?
    Quote Quote  
  3. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    The problem with joining MP4 files with the '+' method is that it will 'ABUT' the 2 files as separate with complete headers. If you run AtomicParsley against it to display the 'Atoms' of the MP4 container and show something like: (excess lines removed for bevity)

    Atom ftyp @ 0 of size: 20, ends @ 20
    Atom moov @ 20 of size: 13148, ends @ 13168

    Atom mvhd @ 28 of size: 108, ends @ 136
    Atom trak @ 136 of size: 9164, ends @ 9300
    Atom tkhd @ 144 of size: 92, ends @ 236
    Atom mdia @ 236 of size: 9012, ends @ 9248


    Atom ftyp @ 9357369 of size: 20, ends @ 9357389
    Atom moov @ 9357389 of size: 13148, ends @ 9370537

    Atom mvhd @ 9357397 of size: 108, ends @ 9357505
    Atom trak @ 9357505 of size: 9164, ends @ 9366669
    Atom tkhd @ 9357513 of size: 92, ends @ 9357605
    Atom mdia @ 9357605 of size: 9012, ends @ 9366617

    Notice the 2 MOOV Atoms that are each a separate file that you add. Some Players will play this and convert but some will not.

    ------------------------------------------------------

    A better way to do this is with the 'Concat' method by adding the files to a txt file called something like 'filelist.txt'
    Then use the FFMPEG concat script shown earlier. This will produce a complete MP4 with one MOOV but several TRAK that should work correctly:

    Atom ftyp @ 0 of size: 32, ends @ 32
    Atom free @ 32 of size: 8, ends @ 40
    Atom mdat @ 40 of size: 18688098, ends @ 18688138
    Atom moov @ 18688138 of size: 25240, ends @ 18713378
    Atom mvhd @ 18688146 of size: 108, ends @ 18688254

    Atom trak @ 18688254 of size: 18018, ends @ 18706272
    Atom tkhd @ 18688262 of size: 92, ends @ 18688354
    Atom edts @ 18688354 of size: 36, ends @ 18688390

    Atom trak @ 18706272 of size: 7008, ends @ 18713280
    Atom tkhd @ 18706280 of size: 92, ends @ 18706372
    Atom edts @ 18706372 of size: 36, ends @ 18706408

    The video I used was approximately 9MB and you can see in the concat method it shows one complete MOOV file with 2 copies (which I used) for approximately 18MB.

    This method works for MP4 that are formatted identical without subtitles. If you wish to join subtitled MP4's, then the method is, again, a little different.
    Quote Quote  
  4. Member
    Join Date
    Feb 2015
    Location
    forgot
    Search PM
    ffmpeg joins 1.mp4 and 2.mp4 when duration of two video are the same - 1.mp4 (40mn 51s) and 2.mp4 (40mn 51s)



    joined.mp4 - videoplayer play it nice (all video)

    ----------------------------------------------------------------------------

    but when duration is different - 1.mp4 (38mn 35s) and 2.mp4 (38mn 38s) - it's only 3s...



    joined.mp4 - videoplayer play only first part (1.mp4), two part (2.mp4) without video, only audio...

    Duration of videos is a big problem?
    Last edited by user155; 6th Feb 2015 at 03:42.
    Quote Quote  
  5. Hi ,

    It works also with :

    ffmpeg -f concat -i mylist.txt -c copy "3_fichiers.mkv"

    === mylist.txt
    file 'E:\concat\media_1.ts'
    file 'E:\concat\media_2.ts'
    file 'E:\concat\media_3.ts'
    ==============

    Cheers .
    JE SUIS CHARLIE !!!
    Quote Quote  
  6. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Different sized videos will join successfully if:

    1. The MP4 ( and others) are formatted THE SAME (size, codec, bitrate, etc.). You cannot join apples and oranges and have it work well.
    2. The original, unjoined MP4's are not damaged or unusual in their encoding.

    If you get a notice that says a PACKET duration is wrong, it probably is for that PACKET not the video. I have tried on many different length/sized MP4's and they do not have a problem but I did encounter several that had problems and, sure enough, they played well in my player but they were not without encoding problems. After re-encoding to correct, they joined fine.

    BTW.. I believe the error in STREAM 1 is the audio.

    aazerty, thanks for verifying .TS also works with this method since i am compiling a list of which work with concat and which work with the COPY /B method.
    Quote Quote  
  7. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Please let us know the outcome of your list. Personally, I would use Copy /B only as a last resort (you already mentioned the duplicate/conflicting headers problem).

    Scott
    Quote Quote  
  8. Member
    Join Date
    Feb 2015
    Location
    forgot
    Search PM
    Originally Posted by Budman1 View Post
    Different sized videos will join successfully if:

    1. The MP4 ( and others) are formatted THE SAME (size, codec, bitrate, etc.). You cannot join apples and oranges and have it work well.
    I've already posted info from Mediainfo:
    https://forum.videohelp.com/threads/368314-Merge-mp4-files-without-reencoding-with-Virt...=1#post2372285
    1.mp4 and 2.mp4 (THE SAME)

    Originally Posted by Budman1 View Post
    BTW.. I believe the error in STREAM 1 is the audio.
    "Stream 1" possibly = "Id 1" (from Mediainfo) so it's still video stream?
    Quote Quote  
  9. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    IIRC, Ffmpeg counts stream #s starting from 0, so stream 1 would be the 2nd stream. Hence, Audio.

    Scott
    Quote Quote  
  10. Member
    Join Date
    Feb 2015
    Location
    forgot
    Search PM
    right, stream from 0

    I see "Duration_LastFrame : -18ms" from Mediainfo
    it can be a problem?
    Quote Quote  
  11. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Not sure, but you could always try: demux/extract the streams, remux single streams (if necessary), join individually, and then remux V+A.

    Scott
    Quote Quote  
  12. Member
    Join Date
    Feb 2015
    Location
    forgot
    Search PM
    I extracted only video from 1.mp4 and 2.mp4:
    Code:
    ffmpeg.exe -i part_1.mp4 -vcodec copy -an 1.mp4
    ffmpeg.exe -i part_2.mp2 -vcodec copy -an 2.mp4
    extracted video streams:

    1.mp4:
    Code:
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L3.1
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 42mn 43s
    Bit rate                                 : 1 980 Kbps
    Width                                    : 1 280 pixels
    Height                                   : 720 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Constant
    Frame rate                               : 25.000 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.086
    Stream size                              : 605 MiB (100%)
    Writing library                          : x264 core 142
    Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=8 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=1980 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
    Encoded date                             : UTC 2015-02-07 13:07:04
    Tagged date                              : UTC 2015-02-07 13:07:55

    2.mp4:

    Code:
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L3.1
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 42mn 47s
    Bit rate                                 : 1 980 Kbps
    Width                                    : 1 280 pixels
    Height                                   : 720 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Constant
    Frame rate                               : 25.000 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.086
    Stream size                              : 606 MiB (100%)
    Writing library                          : x264 core 142
    Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=8 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=1980 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
    Encoded date                             : UTC 2015-02-07 13:16:16
    Tagged date                              : UTC 2015-02-07 13:17:03
    then using ffmpeg joined these video streams and of course (audio:0kb) I didn't have error "packet with invalid duration"

    but it didn't work anyway (part two without video, static image)

    joined.mp4:
    Code:
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L3.1
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 1h 25mn
    Bit rate                                 : 1 980 Kbps
    Width                                    : 1 280 pixels
    Height                                   : 720 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Constant
    Frame rate                               : 25.000 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.086
    Stream size                              : 1.18 GiB (100%)
    Writing library                          : x264 core 142
    Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=8 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=1980 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
    playing joined.mp4:

    00:03:33 = part one = 1.mp4 (with video)


    00:59:55 = part two = 2.mp4 (without video, grey static image

    Last edited by user155; 8th Feb 2015 at 08:35.
    Quote Quote  
  13. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    In case anyone is interested, These are the results of my merges both with ffmpeg and the CMD /b copy method and the results I obtained. Most files were using the AVC video and AAC audio codec except for the MPEG type files that used MPEG2 video and mp2 audio.

    MKV ffmpeg=joins ok but first subtitle
    MKV copy /b = 2 complete movies but time says only one and plays one

    MP4 ffmpeg = joins but loses DVBsubs and srt subs
    MP4 copy /b= 2 complete movies but time says only one and plays one

    VOB FFmpeg = multiple errors trying to join and aborts
    VOB /b works and carries over the DVD subtitles

    3GP ffmpeg=joins/ plays fine ... Subtitles ??????
    3GP copy /b = 2 complete movies but time says only one and plays one

    FLAC ffmpeg= Multiple errors during conversion. Fails (possible bad Flac file to begin with?)
    FLAC copy /b = 2 complete movies but time says only one and plays one

    MPG ffmpeg=joins/ plays fine. Gives correct time and size. Subtitles ??????
    MPG copy /b = Seems to play ok but Time and size is given as only one video.

    M2V = Same as MPG
    M2V /b copy = Same as MPG

    Will post update when I join M2TS from Blu-ray.
    Quote Quote  
  14. Member
    Join Date
    Feb 2015
    Location
    forgot
    Search PM
    I found a solution to correctly join videos (here: http://superuser.com/a/255566)

    Code:
    ffmpeg -i video1.mp4 -c copy -bsf h264_mp4toannexb temp1.ts
    ffmpeg -i video2.mp4 -c copy -bsf h264_mp4toannexb temp2.ts
    ffmpeg -i "concat:temp1.ts|temp2.ts" -c copy -bsf aac_adtstoasc output.mp4
    del temp1.ts temp2.ts
    Last edited by user155; 24th Feb 2015 at 06:21.
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!