VideoHelp Forum
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. Member
    Join Date
    Apr 2018
    Location
    England
    Search PM
    We have two video files: -

    mainfile.mp4
    s1.mp4

    https://www.dropbox.com/sh/81ni6ll1g1sbpjl/AADxio80hgNepNtDyF9mNrK1a?dl=0

    (link to files above)

    We need to combine these two files together WITHOUT re-encoding,

    we can only change so much of the mainfile.mp4 before capturing (captured from an Axis camera, if there is an incompatibility and changing something in the camera will help we will do it).

    we CAN change as much as required in s1.mp4 (this is ideally the file we'd like to change)

    Basically we can alter this files but only the mainfile.mp4 before capturing from the camera and the s1.mp4 can change as much as we want.

    We have a video file mainfile.mp4 but we need to be able to insert s4.mp4 at the start WITHOUT re-encoding (it needs to be a quick process, we know we can probably re-encode but speed is the problem). We already know how to combine these files with a piece of software or if you can tell us how to do it with FFmpeg that would be great too.

    we need to how to create an s1.mp4 video file that is compatible for joining to mainfile.mp4. (to a single mp4 file with s1.mp4 at the start and then mainfile.mp4 to follow it). if you can tell us what software and settings to use as we'll need to make different s1.mp4 files in the future.

    the combined video must play on IOS and Android
    We can get the videos to join and play on andriod phones at the moment, on iPhones/IOS however the video doesn't play for the second part (main.mp4), the combined video file must be capable of playing on Andriod and iPhones/IOS. Our current process will not currently play on iPhones/IOS. We're guessing it's because the videos are different somehow (codecs?) they are both h264 with AAC audio but the video doesn't work once joined on IOS/iPhones =(

    We're guessing there is something wrong with the file the Android phones compensate for iPhones don't like! Some difference in the files?

    We're tried various frame rates and audio channel work but we are stuck!

    Looking forward to some help, we'd really appreciated!

    Thanks.
    Image Attached Files
    Last edited by russt93; 14th Apr 2018 at 05:23.
    Quote Quote  
  2. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    When you say s4.mp4 do you mean Mainfile.mp4? I've reread you request several times and it's late at night here but I'm confused...

    we need to how to create an s1.mp4 video file that is compatible for joining to s4.mp4. (to a single mp4 file with s1.mp4 at the start and then mainfile.mp4 to follow it).
    This sounds like you wish to create a file (s1.mp4) and join it to the s4.mp4 as a new s1.mp4 for joining to Mainfile.mp4.

    If you entered s4.mp4 instead of mainfile.mp4 because of a typo then it makes more sense.
    Quote Quote  
  3. You can use FFmpeg for combine the files:

    This is a example

    ffmpeg -i "concat:input1.mp4|input2.mp4|input3.mp4" -c copy output.mp4

    If you have MP4 files, these could be losslessly concatenated by first transcoding them to mpeg transport streams With h.264 video and AAC audio,
    these are the commands that can be used to combine three mp4 files:

    1) ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts

    2) ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts

    3 ffmpeg -i input3.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate3.ts

    4) ffmpeg -i "concat:intermediate1.ts|intermediate2.ts|intermed iate3.ts" -c copy -bsf:a aac_adtstoasc output.mp4
    Last edited by mindphasar; 14th Apr 2018 at 04:41.
    Quote Quote  
  4. Member
    Join Date
    Apr 2018
    Location
    England
    Search PM
    [QUOTE=Budman1;2517267]When you say s4.mp4 do you mean Mainfile.mp4? I've reread you request several times and it's late at night here but I'm confused...


    If you entered s4.mp4 instead of mainfile.mp4 because of a typo then it makes more sense.

    Sorry yes, typo. I've correct it
    Quote Quote  
  5. Member
    Join Date
    Apr 2018
    Location
    England
    Search PM
    Originally Posted by mindphasar View Post
    You can use FFmpeg for combine the files:

    This is a example

    ffmpeg -i "concat:input1.mp4|input2.mp4|input3.mp4" -c copy output.mp4

    If you have MP4 files, these could be losslessly concatenated by first transcoding them to mpeg transport streams With h.264 video and AAC audio,
    these are the commands that can be used to combine three mp4 files:

    1) ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts

    2) ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts

    3 ffmpeg -i input3.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate3.ts

    4) ffmpeg -i "concat:intermediate1.ts|intermediate2.ts|intermed iate3.ts" -c copy -bsf:a aac_adtstoasc output.mp4
    Thanks, I've tried this as the second method for joining the files that we have. We still have the same problem, the files play in Windows and Android but not on iPhones. I'm guessing there is a difference between the two files (basically not "exact" enough?!) and iPhones don't compensate for the problem like Windows and Android do?

    I'm sorry I think I could have written by question a lot more simply: -

    we can join s1.mp4 to mainfile.mp4 but it won't play on iPhones. I need to know why so I can make a compatible s1.mp4 file that join to mainfile.mp4 that will play on iPhones.

    There are some changes I can make to mainfile.mp4 before it is created if anyone knows the problem? I can do anything to s1.mp4 to make it compatible though which is probably easier?

    I've been stuck on this for almost a week, any help is really appreciated!
    Quote Quote  
  6. Originally Posted by russt93 View Post
    I'm guessing there is a difference between the two files (basically not "exact" enough?!)
    There are various differences in the H.264 SPS/PPS header data. Unfortunately they are hard to copy. I think it may even be impossible with x264 (at least not through cli) to replicate them.
    That said, replicating them 100% may not be necessary. But I do not own any Apple devices to test which ones are causing the problems exactly (or if the problem is something else entirely). Could be a simple as different level or DPB (for ref frames).

    ffmpeg has a function to view the headers: https://ffmpeg.org/ffmpeg-bitstream-filters.html#trace_005fheaders
    Quote Quote  
  7. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    After a quick search on Google for "Iphone will not play mp4", most of the hits claim the level of mp4 should be Profile 3.0? You Mainfile.mp4 is High 4.1 while your s1.mp4 is 3.1. Could this be a problem. Do other files play or fail due to possible profile levels?

    * Video formats supported: H.264 video up to 720p
    * 30 frames per second
    * Main Profile level 3.1
    * with AAC-LC audio up to 160 Kbps
    * 48kHz stereo audio
    * in .m4v, .mp4, and .mov file formats
    Quote Quote  
  8. s1.mp4 is constant frame rate. mainfile.mp4 is variable frame rate. That is bound to cause problems when concatenating them. Use MediaInfo to show some of the other differences: profile@level, # reference frames, etc.

    You can use ffprobe to view reveal more differences. s1.mp4 has ~50 frame GOPs with I, P, and B frames. mailfilemp4 has more variable GOP sizes with only I and P frames.
    Last edited by jagabo; 15th Apr 2018 at 11:08.
    Quote Quote  
  9. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Strangely enough, Avidemux was able to join these files using "append"
    Image Attached Files
    Quote Quote  



Similar Threads

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