{"id":5206,"date":"2014-03-30T19:43:02","date_gmt":"2014-03-30T19:43:02","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/ffmpeg-concat-2-mp4-files-results-in-bad-output-file-collection-of-common-programming-errors\/"},"modified":"2014-03-30T19:43:02","modified_gmt":"2014-03-30T19:43:02","slug":"ffmpeg-concat-2-mp4-files-results-in-bad-output-file-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/ffmpeg-concat-2-mp4-files-results-in-bad-output-file-collection-of-common-programming-errors\/","title":{"rendered":"ffmpeg &#8211; concat 2 mp4 files results in bad output file-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/42e39c71ff504f42f249a7f65a7858e3?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nDevDewboy<\/p>\n<p>I generated 2 mp4 files &#8211; a 5 second intro file which is created by the script below and the main video about 1 minute long is created by screen-cast-omatic both in mp4 format. When I attempt to concat using the &#8220;ffmpeg -f concat -i mylist.txt -c copy output&#8221; method, it produces an output file where the intro file plays fine. Then the main video plays; the audio is fine but the video is messed up where it displays garbled video on top.<\/p>\n<p>Using the &#8220;ffmpeg -i &#8220;concat:input1.mpg|input2.mpg|input3.mpg&#8221; -c copy output.mpg&#8221; method, the output is a video which is not complete. I did not include any script output on this.<\/p>\n<p>Can some check this out and offer a recommendation?<\/p>\n<p>The follow is the script and out put for the first method of concat:<\/p>\n<pre><code># intro_vid.cfg\n#!\/bin\/bash\nINPUTFILE=\"intro_vid.mp4\"\nLOGO=intro\".png\"\nLOGOLENGTH=\"5\"\nSPEAKER=\"Jason\"\nTITLE=\"Basic SSH Video\"\nDATE=\"October 28, 2013\"\nSCENESTART=\"00:00:01\"\nSCENEDURATION=\"00:00:05\"\nOUTPUTFILE=\"intro_vid_final\"\n<\/code><\/pre>\n<p>mylist.txt<\/p>\n<pre><code># Comment\nfile '.\/intro_vid_final-intro.mp4'\nfile '.\/ssh_main.mp4'\n<\/code><\/pre>\n<p>VideoEditIntro.sh #!\/bin\/bash<\/p>\n<pre><code>PARAMFILE=${1}\n\n. ${PARAMFILE}\n\nextractVideo () {\n  # Split the portion of the video that we want to work on directly from the source file\n  # converting the video to frame files one PNG file per frame and\n  # splitting the audio to to an mp3 file\n  rm -fr \"${OUTPUTFILE}-frames\"\n  mkdir -p \"${OUTPUTFILE}-frames\"\n\n  .\/ffmpeg -threads 4 \\\n     -i ${INPUTFILE} -ss ${SCENESTART} -t ${SCENEDURATION} \\\n     -f image2 -y \"${OUTPUTFILE}-frames\"\/frame%d.png \\\n     -c:a copy -y \"${OUTPUTFILE}.m4a\"\n}\n\ncreateIntro () {\n  # Create the introduction image by merging the logo file with the titles for the video\n  convert ${LOGO} -gravity Center -font DejaVu-Sans-Book \\\n     -pointsize 20 -fill gray -draw \"text 1,21 'University'\" \\\n     -fill white -draw \"text 0,20 'University'\" \\\n     -pointsize 50 -fill gray -draw \"text 2,72 '${SPEAKER}'\" \\\n     -fill white -draw \"text 0,70 '${SPEAKER}'\" \\\n     -pointsize 30 -fill gray -draw \"text 1,131 '${TITLE}'\" \\\n     -fill white -draw \"text 0,130 '${TITLE}'\" \\\n     -pointsize 20 -fill gray -draw \"text 1,171 '${DATE}'\" \\\n     -fill white -draw \"text 0,170 '${DATE}'\" \\\n     \"${OUTPUTFILE}-intro.png\"\n\n  # Create still video from the introduction image and silence\n\n  .\/ffmpeg -ar 48000 -t ${LOGOLENGTH} -f s16le -ac 2 \\\n       -channel_layout stereo -c:a pcm_s16le \\\n       -i \/dev\/zero -ab 64K -c:a libvo_aacenc -y silence.m4a\n\n  .\/ffmpeg -loop 1 -i \"${OUTPUTFILE}-intro.png\" -q:v 1 \\\n       -r 29.97 -t ${LOGOLENGTH} -y -f MP4 -pix_fmt yuv420p \"${OUTPUTFILE}-logo1.mp4\"\n\n  .\/ffmpeg -i \"${OUTPUTFILE}-logo1.mp4\" -i \"silence.m4a\" \\\n       -c:v copy -c:a copy -map 0:0 -map 1:0 -threads 4 \\\n       -y -f MP4 \"${OUTPUTFILE}-intro.mp4\"\n\n}\n\nreasembleVideo () {\n  # Merge the modified frames onto the original frames\n  # Reassembles the modified frames and the audio into an output video\n#  .\/ffmpeg -threads 4 \\\n#           -i concat:\"${OUTPUTFILE}-intro.mp4\"\\|\"ssh_main.mp4\" \\\n#           -r 29.97 -y \"${OUTPUTFILE}-final_ssh.mp4\"\n   .\/ffmpeg -f concat -i mylist.txt -codec copy \"${OUTPUTFILE}-final_ssh.mp4\"\n\n\n}\n\n\n\n# These functions do not depend on each other. They can be executed in parallel\nextractVideo &amp;\necho \"CREATE INTRO ROUTINE\"\ncreateIntro &amp;\nwait\nreasembleVideo\n\n# Done!\necho \"Done!\"\n<\/code><\/pre>\n<p>The following is the processing output:<\/p>\n<pre><code>iavideo@colfax:~$ cd video\/wip2\/\niavideo@colfax:~\/video\/wip2$ cd video\/wip2\/.\/VideoEditIntro.sh intro_vid.cfg \nCREATE INTRO ROUTINE\nffmpeg version N-57401-ga443b97 Copyright (c) 2000-2013 the FFmpeg developers\n  built on Oct 25 2013 05:34:36 with gcc 4.6 (Debian 4.6.3-1)\n  configuration: --prefix=\/root\/ffmpeg-static\/64bit --extra-cflags='-I\/root\/ffmpeg-static\/64bit\/include -static' --extra-ldflags='-L\/root\/ffmpeg-static\/64bit\/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx\n  libavutil      52. 47.101 \/ 52. 47.101\n  libavcodec     55. 38.101 \/ 55. 38.101\n  libavformat    55. 19.104 \/ 55. 19.104\n  libavdevice    55.  5.100 \/ 55.  5.100\n  libavfilter     3. 89.100 \/  3. 89.100\n  libswscale      2.  5.101 \/  2.  5.101\n  libswresample   0. 17.104 \/  0. 17.104\n  libpostproc    52.  3.100 \/ 52.  3.100\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from 'intro_vid.mp4':\n  Metadata:\n    major_brand     : isom\n    minor_version   : 512\n    compatible_brands: isomiso2avc1mp41\n    creation_time   : 1970-01-01 00:00:00\n  Duration: 00:00:07.00, start: 0.000000, bitrate: 116 kb\/s\n    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 \/ 0x31637661), yuv420p, 1720x752, 46 kb\/s, 10 fps, 10 tbr, 10 tbn, 20 tbc (default)\n    Metadata:\n      creation_time   : 1970-01-01 00:00:00\n      handler_name    : VideoHandler\n    Stream #0:1(und): Audio: aac (mp4a \/ 0x6134706D), 44100 Hz, mono, fltp, 75 kb\/s (default)\n    Metadata:\n      creation_time   : 1970-01-01 00:00:00\n      handler_name    : SoundHandler\n[libx264 @ 0x3a6c140] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2\n[libx264 @ 0x3a6c140] profile High, level 3.2\n[libx264 @ 0x3a6c140] 264 - core 129 r2230 1cffe9f - H.264\/MPEG-4 AVC codec - Copyleft 2003-2012 - http:\/\/www.videolan.org\/x264.html - options: 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=6 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=10 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00\nOutput #0, image2, to 'intro_vid_final-frames\/frame%d.png':\n  Metadata:\n    major_brand     : isom\n    minor_version   : 512\n    compatible_brands: isomiso2avc1mp41\n    encoder         : Lavf55.19.104\n    Stream #0:0(und): Video: png, rgb24, 1720x752, q=2-31, 200 kb\/s, 90k tbn, 10 tbc (default)\n    Metadata:\n      creation_time   : 1970-01-01 00:00:00\n      handler_name    : VideoHandler\nOutput #1, ipod, to 'intro_vid_final.m4a':\n  Metadata:\n    major_brand     : isom\n    minor_version   : 512\n    compatible_brands: isomiso2avc1mp41\n    encoder         : Lavf55.19.104\n    Stream #1:0(und): Video: h264 (libx264) (avc1 \/ 0x31637661), yuv420p, 1720x752, q=-1--1, 10240 tbn, 10 tbc (default)\n    Metadata:\n      creation_time   : 1970-01-01 00:00:00\n      handler_name    : VideoHandler\n    Stream #1:1(und): Audio: aac (mp4a \/ 0x6134706D), 44100 Hz, mono, 75 kb\/s (default)\n    Metadata:\n      creation_time   : 1970-01-01 00:00:00\n      handler_name    : SoundHandler\nStream mapping:\n  Stream #0:0 -&gt; #0:0 (h264 -&gt; png)\n  Stream #0:0 -&gt; #1:0 (h264 -&gt; libx264)\n  Stream #0:1 -&gt; #1:1 (copy)\nPress [q] to stop, [?] for help\nffmpeg version N-57401-ga443b97 Copyright (c) 2000-2013 the FFmpeg developers\n  built on Oct 25 2013 05:34:36 with gcc 4.6 (Debian 4.6.3-1)\n  configuration: --prefix=\/root\/ffmpeg-static\/64bit --extra-cflags='-I\/root\/ffmpeg-static\/64bit\/include -static' --extra-ldflags='-L\/root\/ffmpeg-static\/64bit\/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx\n  libavutil      52. 47.101 \/ 52. 47.101\n  libavcodec     55. 38.101 \/ 55. 38.101\n  libavformat    55. 19.104 \/ 55. 19.104\n  libavdevice    55.  5.100 \/ 55.  5.100\n  libavfilter     3. 89.100 \/  3. 89.100\n  libswscale      2.  5.101 \/  2.  5.101\n  libswresample   0. 17.104 \/  0. 17.104\n  libpostproc    52.  3.100 \/ 52.  3.100\nInput #0, s16le, from '\/dev\/zero':\n  Duration: N\/A, bitrate: 1536 kb\/s\n    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb\/s\nOutput #0, ipod, to 'silence.m4a':\n  Metadata:\n    encoder         : Lavf55.19.104\n    Stream #0:0: Audio: aac (libvo_aacenc) (mp4a \/ 0x6134706D), 48000 Hz, stereo, s16, 64 kb\/s\nStream mapping:\n  Stream #0:0 -&gt; #0:0 (pcm_s16le -&gt; libvo_aacenc)\nPress [q] to stop, [?] for help\nsize=      41kB time=00:00:05.00 bitrate=  67.1kbits\/s    \n\nvideo:0kB audio:39kB subtitle:0 global headers:0kB muxing overhead 4.190769%\nffmpeg version N-57401-ga443b97 Copyright (c) 2000-2013 the FFmpeg developers\n  built on Oct 25 2013 05:34:36 with gcc 4.6 (Debian 4.6.3-1)\n  configuration: --prefix=\/root\/ffmpeg-static\/64bit --extra-cflags='-I\/root\/ffmpeg-static\/64bit\/include -static' --extra-ldflags='-L\/root\/ffmpeg-static\/64bit\/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx\n  libavutil      52. 47.101 \/ 52. 47.101\n  libavcodec     55. 38.101 \/ 55. 38.101\n  libavformat    55. 19.104 \/ 55. 19.104\n  libavdevice    55.  5.100 \/ 55.  5.100\n  libavfilter     3. 89.100 \/  3. 89.100\n  libswscale      2.  5.101 \/  2.  5.101\n  libswresample   0. 17.104 \/  0. 17.104\n  libpostproc    52.  3.100 \/ 52.  3.100\nInput #0, image2, from 'intro_vid_final-intro.png':\n  Duration: 00:00:00.04, start: 0.000000, bitrate: N\/A\n    Stream #0:0: Video: png, rgba, 1720x752, 25 fps, 25 tbr, 25 tbn, 25 tbc\n[libx264 @ 0x32d6860] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2\n[libx264 @ 0x32d6860] profile High, level 3.2\n[libx264 @ 0x32d6860] 264 - core 129 r2230 1cffe9f - H.264\/MPEG-4 AVC codec - Copyleft 2003-2012 - http:\/\/www.videolan.org\/x264.html - options: 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=6 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=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00\nOutput #0, mp4, to 'intro_vid_final-logo1.mp4':\n  Metadata:\n    encoder         : Lavf55.19.104\n    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] \/ 0x0021), yuv420p, 1720x752, q=-1--1, 11988 tbn, 29.97 tbc\nStream mapping:\n  Stream #0:0 -&gt; #0:0 (png -&gt; libx264)\nPress [q] to stop, [?] for help\nframe=   32 fps=0.0 q=0.0 q=0.0 size=N\/A time=00:00:04.43 bitrate=N\/A    \nframe=   41 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N\/A dup=7 drop=0    \nframe=   50 fps= 49 q=0.0 q=25.0 size=N\/A time=00:00:06.10 bitrate=N\/A    \nframe=   73 fps= 72 q=29.0 size=       8kB time=00:00:00.70 bitrate=  97.6kbits\/s dup=12 drop=0    \nframe=   50 fps= 33 q=0.0 Lq=-1.0 size=N\/A time=00:00:06.80 bitrate=N\/A    \n\nvideo:608kB audio:57kB subtitle:0 global headers:0kB muxing overhead -100.003232%\n[libx264 @ 0x3a6c140] frame I:1     Avg QP: 6.68  size:  2396\n[libx264 @ 0x3a6c140] frame P:18    Avg QP: 7.26  size:   583\n[libx264 @ 0x3a6c140] frame B:51    Avg QP: 9.71  size:    74\n[libx264 @ 0x3a6c140] consecutive B-frames:  2.9%  0.0%  0.0% 97.1%\n[libx264 @ 0x3a6c140] mb I  I16..4: 99.4%  0.0%  0.6%\n[libx264 @ 0x3a6c140] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.3%  0.1%  0.1%  0.0%  0.0%    skip:99.6%\n[libx264 @ 0x3a6c140] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.1%  0.0%  0.0%  direct: 0.0%  skip:99.9%  L0:53.1% L1:46.8% BI: 0.1%\n[libx264 @ 0x3a6c140] 8x8 transform intra:0.0% inter:10.8%\n[libx264 @ 0x3a6c140] coded y,uvDC,uvAC intra: 0.4% 0.0% 0.0% inter: 0.1% 0.0% 0.0%\n[libx264 @ 0x3a6c140] i16 v,h,dc,p: 98%  0%  2%  0%\n[libx264 @ 0x3a6c140] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 28% 26%  2%  5%  4% 10%  3%  6%\n[libx264 @ 0x3a6c140] i8c dc,h,v,p: 100%  0%  0%  0%\n[libx264 @ 0x3a6c140] Weighted P-Frames: Y:44.4% UV:0.0%\n[libx264 @ 0x3a6c140] ref P L0: 72.8% 11.4% 15.1%  0.2%  0.5%\n[libx264 @ 0x3a6c140] ref B L0: 86.6% 13.4%\n[libx264 @ 0x3a6c140] kb\/s:19.03\nframe=  124 fps= 82 q=29.0 size=      11kB time=00:00:02.40 bitrate=  37.0kbits\/s dup=20 drop=0    \nframe=  150 fps= 77 q=-1.0 Lsize=      17kB time=00:00:04.93 bitrate=  28.3kbits\/s dup=25 drop=0    \n\nvideo:14kB audio:0kB subtitle:0 global headers:0kB muxing overhead 17.449439%\n[libx264 @ 0x32d6860] frame I:1     Avg QP:15.18  size:  6574\n[libx264 @ 0x32d6860] frame P:38    Avg QP:10.44  size:    59\n[libx264 @ 0x32d6860] frame B:111   Avg QP:13.67  size:    48\n[libx264 @ 0x32d6860] consecutive B-frames:  1.3%  0.0%  0.0% 98.7%\n[libx264 @ 0x32d6860] mb I  I16..4: 97.4%  0.0%  2.6%\n[libx264 @ 0x32d6860] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.0%  0.0%  0.0%  0.0%  0.0%    skip:100.0%\n[libx264 @ 0x32d6860] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.0%  0.0%  0.0%  direct: 0.0%  skip:100.0%  L0:69.8% L1:30.2% BI: 0.0%\n[libx264 @ 0x32d6860] 8x8 transform intra:0.0% inter:12.5%\n[libx264 @ 0x32d6860] coded y,uvDC,uvAC intra: 1.7% 0.0% 0.0% inter: 0.0% 0.0% 0.0%\n[libx264 @ 0x32d6860] i16 v,h,dc,p: 98%  0%  2%  0%\n[libx264 @ 0x32d6860] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 47% 20% 14%  2%  2%  3%  4%  3%  4%\n[libx264 @ 0x32d6860] i8c dc,h,v,p: 100%  0%  0%  0%\n[libx264 @ 0x32d6860] Weighted P-Frames: Y:0.0% UV:0.0%\n[libx264 @ 0x32d6860] ref B L0:  2.7% 97.3%\n[libx264 @ 0x32d6860] kb\/s:22.63\nffmpeg version N-57401-ga443b97 Copyright (c) 2000-2013 the FFmpeg developers\n  built on Oct 25 2013 05:34:36 with gcc 4.6 (Debian 4.6.3-1)\n  configuration: --prefix=\/root\/ffmpeg-static\/64bit --extra-cflags='-I\/root\/ffmpeg-static\/64bit\/include -static' --extra-ldflags='-L\/root\/ffmpeg-static\/64bit\/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx\n  libavutil      52. 47.101 \/ 52. 47.101\n  libavcodec     55. 38.101 \/ 55. 38.101\n  libavformat    55. 19.104 \/ 55. 19.104\n  libavdevice    55.  5.100 \/ 55.  5.100\n  libavfilter     3. 89.100 \/  3. 89.100\n  libswscale      2.  5.101 \/  2.  5.101\n  libswresample   0. 17.104 \/  0. 17.104\n  libpostproc    52.  3.100 \/ 52.  3.100\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from 'intro_vid_final-logo1.mp4':\n  Metadata:\n    major_brand     : isom\n    minor_version   : 512\n    compatible_brands: isomiso2avc1mp41\n    encoder         : Lavf55.19.104\n  Duration: 00:00:05.01, start: 0.000000, bitrate: 27 kb\/s\n    Stream #0:0(und): Video: h264 (High) (avc1 \/ 0x31637661), yuv420p, 1720x752, 23 kb\/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc (default)\n    Metadata:\n      handler_name    : VideoHandler\nInput #1, mov,mp4,m4a,3gp,3g2,mj2, from 'silence.m4a':\n  Metadata:\n    major_brand     : M4A \n    minor_version   : 512\n    compatible_brands: isomiso2\n    encoder         : Lavf55.19.104\n  Duration: 00:00:05.03, start: 0.033333, bitrate: 66 kb\/s\n    Stream #1:0(und): Audio: aac (mp4a \/ 0x6134706D), 48000 Hz, stereo, fltp, 64 kb\/s (default)\n    Metadata:\n      handler_name    : SoundHandler\nOutput #0, mp4, to 'intro_vid_final-intro.mp4':\n  Metadata:\n    major_brand     : isom\n    minor_version   : 512\n    compatible_brands: isomiso2avc1mp41\n    encoder         : Lavf55.19.104\n    Stream #0:0(und): Video: h264 ([33][0][0][0] \/ 0x0021), yuv420p, 1720x752, q=2-31, 23 kb\/s, 29.97 fps, 11988 tbn, 11988 tbc (default)\n    Metadata:\n      handler_name    : VideoHandler\n    Stream #0:1(und): Audio: aac ([64][0][0][0] \/ 0x0040), 48000 Hz, stereo, 64 kb\/s (default)\n    Metadata:\n      handler_name    : SoundHandler\nStream mapping:\n  Stream #0:0 -&gt; #0:0 (copy)\n  Stream #1:0 -&gt; #0:1 (copy)\nPress [q] to stop, [?] for help\nframe=  150 fps=0.0 q=-1.0 Lsize=      60kB time=00:00:05.03 bitrate=  98.4kbits\/s    \n\nvideo:14kB audio:39kB subtitle:0 global headers:0kB muxing overhead 12.325164%\nffmpeg version N-57401-ga443b97 Copyright (c) 2000-2013 the FFmpeg developers\n  built on Oct 25 2013 05:34:36 with gcc 4.6 (Debian 4.6.3-1)\n  configuration: --prefix=\/root\/ffmpeg-static\/64bit --extra-cflags='-I\/root\/ffmpeg-static\/64bit\/include -static' --extra-ldflags='-L\/root\/ffmpeg-static\/64bit\/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx\n  libavutil      52. 47.101 \/ 52. 47.101\n  libavcodec     55. 38.101 \/ 55. 38.101\n  libavformat    55. 19.104 \/ 55. 19.104\n  libavdevice    55.  5.100 \/ 55.  5.100\n  libavfilter     3. 89.100 \/  3. 89.100\n  libswscale      2.  5.101 \/  2.  5.101\n  libswresample   0. 17.104 \/  0. 17.104\n  libpostproc    52.  3.100 \/ 52.  3.100\n[concat @ 0x2497f80] Estimating duration from bitrate, this may be inaccurate\nInput #0, concat, from 'mylist.txt':\n  Duration: 00:00:00.01, start: 0.000000, bitrate: 86 kb\/s\n    Stream #0:0: Video: h264 (High) (avc1 \/ 0x31637661), yuv420p, 1720x752, 23 kb\/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc\n    Stream #0:1: Audio: aac (mp4a \/ 0x6134706D), 48000 Hz, stereo, fltp, 63 kb\/s\nOutput #0, mp4, to 'intro_vid_final-final_ssh.mp4':\n  Metadata:\n    encoder         : Lavf55.19.104\n    Stream #0:0: Video: h264 ([33][0][0][0] \/ 0x0021), yuv420p, 1720x752, q=2-31, 23 kb\/s, 29.97 fps, 11988 tbn, 11988 tbc\n    Stream #0:1: Audio: aac ([64][0][0][0] \/ 0x0040), 48000 Hz, stereo, 63 kb\/s\nStream mapping:\n  Stream #0:0 -&gt; #0:0 (copy)\n  Stream #0:1 -&gt; #0:1 (copy)\nPress [q] to stop, [?] for help\n[mp4 @ 0x24a7a00] Non-monotonous DTS in output stream 0:0; previous: 58800, current: 51; changing to 58801. This may result in incorrect timestamps in the output file.\n[mp4 @ 0x24a7a00] Non-monotonous DTS in output stream 0:1; previous: 240640, current: 223455; changing to 240641. This may result in incorrect timestamps in the output file.\n[mp4 @ 0x24a7a00] Non-monotonous DTS in output stream 0:1; previous: 240641, current: 224479; changing to 240642. This may result in incorrect timestamps in the output file.\n[mp4 @ 0x24a7a00] Non-monotonous DTS in output stream 0:1; previous: 240642, current: 225503; changing to 240643. This may result in incorrect timestamps in the output file.\n[mp4 @ 0x24a7a00] Non-monotonous DTS in output stream 0:1; previous: 240643, current: 226527; changing to 240644. This may result in incorrect timestamps in the output file.\n\n... about 400 similar line removed\n\n[mp4 @ 0x24a7a00] Non-monotonous DTS in output stream 0:0; previous: 59305, current: 556; changing to 59306. This may result in incorrect timestamps in the output file.\n[mp4 @ 0x24a7a00] Non-monotonous DTS in output stream 0:0; previous: 59306, current: 557; changing to 59307. This may result in incorrect timestamps in the output file.\n[mp4 @ 0x24a7a00] Non-monotonous DTS in output stream 0:0; previous: 59307, current: 558; changing to 59308. This may result in incorrect timestamps in the output file.\n[mp4 @ 0x24a7a00] Non-monotonous DTS in output stream 0:0; previous: 59308, current: 559; changing to 59309. This may result in incorrect timestamps in the output file.\n[mp4 @ 0x24a7a00] Non-monotonous DTS in output stream 0:0; previous: 59309, current: 560; changing to 59310. This may result in incorrect timestamps in the output file.\nframe=  660 fps=0.0 q=-1.0 Lsize=    2287kB time=00:00:50.99 bitrate= 367.4kbits\/s    \n\nvideo:1763kB audio:507kB subtitle:0 global headers:0kB muxing overhead 0.759429%\nDone!\niavideo@colfax:~\/video\/wip2$ \n<\/code><\/pre>\n<p>I tried using <code>memcoder<\/code> to concatenate the 2 videos and I get a problem there. I suspect it has to do with the codec or fps\/bit rates etc, so I tweaked the script to 10 fps on both videos and here is <code>memcoders<\/code> output:<\/p>\n<pre><code>iavideo@colfax:~\/video\/wip2$ mencoder -oac pcm -ovc copy -o intro_vid_final_ssh_2.mp4 intro_vid_final-intro.mp4 ssh_main.mp4\nMEncoder svn r34540 (Ubuntu), built with gcc-4.6 (C) 2000-2012 MPlayer Team\n\nWARNING: OUTPUT FILE FORMAT IS _AVI_. See -of help.\nsuccess: format: 0  data: 0x0 - 0xd26c\nlibavformat version 53.21.1 (external)\nMismatching header version 53.19.0\nlibavformat file format detected.\n[lavf] stream 0: video (h264), -vid 0\n[lavf] stream 1: audio (aac), -aid 0, -alang und\nVIDEO:  [H264]  1720x752  24bpp  10.000 fps   17.7 kbps ( 2.2 kbyte\/s)\n[V] filefmt:44  fourcc:0x34363248  size:1720x752  fps:10.000  ftime:=0.1000\n==========================================================================\nOpening audio decoder: [ffmpeg] FFmpeg\/libavcodec audio decoders\nlibavcodec version 53.35.0 (external)\nMismatching header version 53.32.2\nAUDIO: 44100 Hz, 1 ch, s16le, 63.3 kbit\/8.97% (ratio: 7914-&gt;88200)\nSelected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2\/MPEG-4 Audio))\n==========================================================================\nvideocodec: framecopy (1720x752 24bpp fourcc=34363248)\nWriting header...\nODML: Aspect information not (yet?) available or unspecified, not writing vprp header.\nWriting header...\nODML: Aspect information not (yet?) available or unspecified, not writing vprp header.\nPos:   4.9s     50f (100%)  0.00fps Trem:   0min   0mb  A-V:0.063 [18:705]\nsuccess: format: 0  data: 0x0 - 0x22f78d\nlibavformat file format detected.\n[lavf] stream 0: video (h264), -vid 0\n[lavf] stream 1: audio (aac), -aid 0, -alang und\nVIDEO:  [H264]  1720x752  24bpp  10.000 fps  280.8 kbps (34.3 kbyte\/s)\n[V] filefmt:44  fourcc:0x34363248  size:1720x752  fps:10.000  ftime:=0.1000\n==========================================================================\nOpening audio decoder: [ffmpeg] FFmpeg\/libavcodec audio decoders\nAUDIO: 44100 Hz, 1 ch, s16le, 75.9 kbit\/10.76% (ratio: 9493-&gt;88200)\nSelected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2\/MPEG-4 Audio))\n==========================================================================\nvideocodec: framecopy (1720x752 24bpp fourcc=34363248)\nvideocodec: framecopy (1720x752 24bpp fourcc=34363248)\n\nAll video files must have identical fps, resolution, and codec for -ovc copy.\n\nExiting...\niavideo@colfax:~\/video\/wip2$\n<\/code><\/pre>\n<p>Use MP4Box I get the error that it can&#8217;t concatenate the files because the AVCs are different. Here is the output:<\/p>\n<pre><code>iavideo@colfax:~\/video\/wip2$ MP4Box -cat intro_vid_final-intro.mp4 -cat ssh_main.mp4 intro_vid_final_ssh_3.mp4\nAppending file intro_vid_final-intro.mp4\nCannot concatenate files: Different AVC Profile Indication between source (100) and destination (66)\nAppending file ssh_main.mp4\nSaving intro_vid_final_ssh_3.mp4: 0.500 secs Interleaving\niavideo@colfax:~\/video\/wip2$\n<\/code><\/pre>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e43bb728aa52682f0519d8c49ed661cd?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRajib<\/p>\n<p>Do not use the concat demuxer or concat protocol when the source files may have different codecs or other differences. Use the concat filter. That will re-encode all, but will produce stable results.<\/p>\n<blockquote>\n<pre><code>ffmpeg -i title -i main -y -filter_complex '[0:0] setsar=1\/1[sarfix];[sarfix] [1:0] concat=n=2:v=1:a=0 [v]' -map '[v]' -pass 1 -strict -2 -an -vcodec libx264 -pix_fmt yuv420p -aspect 16:9 -threads 4 -b:v 2400k -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 1 -trellis 0 -refs 1 -bf 3 -b_strategy 2 -coder 1 -me_range 16 -g 250 -keyint_min 75 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 output.mp4  \n\nffmpeg -i title -i main -y -filter_complex '[0:0] setsar=1\/1[sarfix];[sarfix] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1[v] [a]' -map '[v]' -map '[a]' -strict -2 -acodec aac -b:a 128k -pass 2 -vcodec libx264 -pix_fmt yuv420p -aspect 16:9 -threads 4 -b:v 2400k -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -mixed-refs 1 -subq 6 -trellis 1 -refs 5 -bf 3 -b_strategy 2 -coder 1 -me_range 16 -g 250 -keyint_min 75 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 output.mp4  \n<\/code><\/pre>\n<\/blockquote>\n<p>This shows a two pass solution. In pass 1 audio is ignored. It does not matter how your two sections input are produced.<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>DevDewboy I generated 2 mp4 files &#8211; a 5 second intro file which is created by the script below and the main video about 1 minute long is created by screen-cast-omatic both in mp4 format. When I attempt to concat using the &#8220;ffmpeg -f concat -i mylist.txt -c copy output&#8221; method, it produces an output [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5206","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5206","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5206"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5206\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}