VideoHelp Forum
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. Hello!

    I have read a lot of topics here about this and I'm not sure if my problem is different but I'm trying a different approach.

    I have a intro file with this settings

    Code:
    General
    Complete name               : intro.mp4
    Format                      : MPEG-4
    Format profile              : Base Media / Version 2
    Codec ID                    : mp42 (isom/mp41/mp42)
    File size                   : 592 KiB
    Duration                    : 6 s 960 ms
    Overall bit rate mode       : Variable
    Overall bit rate            : 697 kb/s
    
    Video
    ID                          : 2
    Format                      : AVC
    Format/Info                 : Advanced Video Codec
    Format profile              : High@L3.1
    Format settings             : CABAC / 2 Ref Frames
    Format settings, CABAC      : Yes
    Format settings, ReFrames   : 2 frames
    Format settings, GOP        : M=1, N=30
    Codec ID                    : avc1
    Codec ID/Info               : Advanced Video Coding
    Duration                    : 6 s 960 ms
    Bit rate mode               : Variable
    Bit rate                    : 555 kb/s
    Maximum bit rate            : 768 kb/s
    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.024
    Stream size                 : 472 KiB (80%)
    Title                       : Core Media Video
    Color range                 : Limited
    Color primaries             : BT.709
    Transfer characteristics    : BT.709
    Matrix coefficients         : BT.709
    
    Audio
    ID                          : 1
    Format                      : AAC
    Format/Info                 : Advanced Audio Codec
    Format profile              : LC
    Codec ID                    : mp4a-40-2
    Duration                    : 6 s 960 ms
    Source duration             : 7 s 19 ms
    Bit rate mode               : Constant
    Bit rate                    : 119 kb/s
    Nominal bit rate            : 128 kb/s
    Channel(s)                  : 2 channels
    Channel positions           : Front: L R
    Sampling rate               : 48.0 kHz
    Frame rate                  : 46.875 FPS (1024 SPF)
    Compression mode            : Lossy
    Stream size                 : 101 KiB (17%)
    Source stream size          : 101 KiB (17%)
    Title                       : Core Media Audio
    Language                    : English
    and an original file with this settings

    Code:
    General
    Complete name                            : original.mp4
    Format                                   : MPEG-4
    Format profile                           : Base Media
    Codec ID                                 : isom (isom/iso2/avc1/mp41)
    File size                                : 447 MiB
    Duration                                 : 22 min 58 s
    Overall bit rate                         : 2 721 kb/s
    Writing application                      : Lavf58.29.100
    
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L3.1
    Format settings                          : CABAC / 2 Ref Frames
    Format settings, CABAC                   : Yes
    Format settings, Reference frames        : 2 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 22 min 57 s
    Bit rate                                 : 2 589 kb/s
    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.112
    Stream size                              : 425 MiB (95%)
    Writing library                          : x264 core 157 r2969 d4099dd
    Encoding settings                        : cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x3:0x3 / me=dia / subme=3 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=8 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=0 / 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=0 / rc=crf / mbtree=0 / crf=24.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / vbv_maxrate=3000 / vbv_bufsize=3000 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=0.71 / pb_ratio=1.30 / aq=1:1.00
    Language                                 : English
    Menus                                    : 3
    Codec configuration box                  : avcC
    
    Audio
    ID                                       : 2
    Format                                   : AAC LC
    Format/Info                              : Advanced Audio Codec Low Complexity
    Codec ID                                 : mp4a-40-2
    Duration                                 : 22 min 58 s
    Duration_LastFrame                       : -6 ms
    Bit rate mode                            : Constant
    Bit rate                                 : 128 kb/s
    Channel(s)                               : 2 channels
    Channel layout                           : L R
    Sampling rate                            : 44.1 kHz
    Frame rate                               : 43.066 FPS (1024 SPF)
    Compression mode                         : Lossy
    Stream size                              : 21.1 MiB (5%)
    Language                                 : English
    Default                                  : Yes
    Alternate group                          : 1
    Menus                                    : 3
    
    Menu #1
    ID                                       : 3
    Codec ID                                 : text
    Duration                                 : 22 min 58 s
    Language                                 : English
    Bit rate mode                            : CBR
    Menu For                                 : 1,2
    00:00:00.000                             : 00:00:00.000
    00:06:24.426                             : 00:06:24.426
    00:15:49.115                             : 00:15:49.115
    00:21:37.671                             : 00:21:37.671
    00:22:29.557                             : 00:22:29.557
    Bit rate mode                            : Constant
    
    Menu #2
    00:00:00.000                             : 00:00:00.000
    00:06:24.426                             : 00:06:24.426
    00:15:49.115                             : 00:15:49.115
    00:21:37.671                             : 00:21:37.671
    00:22:29.557                             : 00:22:29.557
    I would like to join those files without re-encoding.
    The question is , how do I encode only the "intro" video to match the original video settings.
    What should I change and how ?

    When I try to join them via ffmeg with this command :ffmpeg -f concat -safe 0 -i mylist.txt -ma
    p 0 -c copy output.mp4

    I get this :

    Code:
    [mp4 @ 0000005cd1956880] Non-monotonous DTS in output stream 0:0; previous: 6292
    75, current: 580211; changing to 629276. This may result in incorrect timestamps
     in the output file.
    [mp4 @ 0000005cd1956880] Non-monotonous DTS in output stream 0:0; previous: 6293
    71, current: 629363; changing to 629372. This may result in incorrect timestamps
     in the output file.
    ...
     in the output file.
    frame=14308 fps=14299 q=-1.0 size=  184576kB time=00:08:45.78 bitrate=2875.8kbit
    frame=26852 fps=17890 q=-1.0 size=  364800kB time=00:16:26.77 bitrate=3028.5kbit
    frame=34610 fps=19088 q=-1.0 Lsize=  458152kB time=00:21:12.85 bitrate=2948.6kbi
    ts/s speed= 702x
    video:435465kB audio:21684kB subtitle:0kB other streams:0kB global headers:0kB m
    uxing overhead: 0.219454%
    Quote Quote  
  2. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    If a timestamp gap is the only concern, and everything else matches good enough ... timestamps can be recreated continuously.
    Quote Quote  
  3. I have fixed the timestamp by re-encoding the intro to match the same encoding proprieties.
    But now I have another problem with adding the same intro to multiple files.

    In mylist.txt are

    file 'intro.mp4'
    file 'original.mp4'

    and I use this command for a single file.

    ffmpeg>ffmpeg -f concat -safe 0 -i mylist.txt -map 0 -c copy outputoriginal1.mp4

    I would like to add to mylist.txt multiple files to add the same intro to those files.

    file 'intro.mp4'
    file 'newfile1.mp4
    file 'intro.mp4'
    file 'newfile2.mp4'
    file 'intro.mp4'
    file 'newfile3.mp4'

    and so on.

    and the output to be

    outputnewfile1.mp4,outputnewfile2.mp4,outputnewfil e3.mp4
    Quote Quote  
  4. I have tried , and the weird thing is that when I'm joining the files the audio of the second file is not there.
    But it worked with MkXToolNix Gui and it takes a lot of time when you have to add intro to 100 vids.
    I will be glad and others who read this topic for a easier method using ffmpeg for multiple files.
    Quote Quote  
  5. Originally Posted by zyck View Post
    I have tried , and the weird thing is that when I'm joining the files the audio of the second file is not there.
    But it worked with MkXToolNix Gui and it takes a lot of time when you have to add intro to 100 vids.
    The GUI can show you the command line equivalent. You could use that to build a batch file that uses mkvmerge.

    Here's an example of an batch file that will use MkvMerge to prepend intro.mp4 to each file of the form newfile*.mp4 to create a new file called newfile*.mkv:

    Code:
    for %%F in (newfile*.mp4) do (
        "G:/Program Files/mkvtoolnix\mkvmerge.exe" ^
        --output "%%~dpnF.mkv" ^
        "%%~dpF\intro.mp4" ^
        + "%%~dpnxF" ^
        --append-to 1:0:0:0
    )
    pause
    Put that in a folder and all the MP4 files will be muxed to new MKV files. Change the path to mkvmerge.exe as necessary. You may need to modify other command line options depending on what's necessary to append your files. I tested with mp4 file with only video. And the video was encoded with two different AVC encoders with different settings (otherwise the same video). Mkvmerge warned that there was a mis-match between the videos but continued to append them. And the new mkv file play properly.
    Last edited by jagabo; 13th Jun 2020 at 10:50.
    Quote Quote  
  6. Thanks ! It worked !
    Quote Quote  
  7. Be sure to check the new MKV files carefully. Some players might crash when playing them. Or the audio may lose sync with the video. Etc.
    Quote Quote  
  8. any other software
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!