Stacking different length videos not working with ffmpeg and -itsoffset - ffmpeg

I developed a video conferencing app that records the video streams separately, and I am now looking for a way to merge them. At the moment I am experimenting with -itsoffset and hstack to stack 2 videos side by side using this command:
ffmpeg \
-itsoffset 17 -i smaller.mp4 \
-itsoffset 0 -i bigger.mp4 \
-filter_complex hstack=inputs=2 \
-c:v libx264 -crf 23 out.mp4
The result is a side by side video where both streams remain frozen for 17 seconds then start playing, even the bigger.mp4 video that should start at time 0.
Any help would be really appreciated!
ffmpeg verbose:
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.9.2 (Debian 4.9.2-10+deb8u1)
configuration: --enable-gpl --enable-postproc --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libx264 --enable-libspeex --enab le-shared --enable-pthreads --enable-libopenjpeg --enable-nonfree --enable-libopus --enable-libvorbis --enable-libvpx
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'smaller.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:00:05.16, start: 0.000000, bitrate: 444 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 480x360 [SAR 1:1 DAR 4:3], 330 kb/s, 32 fps, 32 tbr, 16384 tbn, 64 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 103 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'bigger.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.36.100
Duration: 00:00:22.03, start: 0.000000, bitrate: 290 kb/s
Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 480x360 [SAR 1:1 DAR 4:3], 177 kb/s, 32 fps, 32 tbr, 16384 tbn, 64 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 103 kb/s (default)
Metadata:
handler_name : SoundHandler
File 'out.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
Stream #0:0 (h264) -> hstack:input0 (graph 0)
Stream #1:0 (h264) -> hstack:input1 (graph 0)
hstack (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 # 0x206ed00] using SAR=1/1
[libx264 # 0x206ed00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 # 0x206ed00] profile High, level 3.1
[libx264 # 0x206ed00] 264 - core 146 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=3 lookahead_threads=1 sliced_thre ads=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 scene cut=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
Output #0, mp4, to 'out.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 960x360 [SAR 1:1 DAR 8:3], q=-1--1, 32 fps, 16384 tbn, 32 tbc (default)
Metadata:
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.35.100 aac
frame= 709 fps=130 q=-1.0 Lsize= 573kB time=00:00:22.12 bitrate= 212.2kbits/s dup=544 drop=0 speed=4.05x
video:478kB audio:81kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.445685%
[libx264 # 0x206ed00] frame I:3 Avg QP:16.86 size: 38355
[libx264 # 0x206ed00] frame P:190 Avg QP:18.22 size: 1633
[libx264 # 0x206ed00] frame B:516 Avg QP:16.23 size: 123
[libx264 # 0x206ed00] consecutive B-frames: 1.3% 2.8% 6.8% 89.1%
[libx264 # 0x206ed00] mb I I16..4: 6.6% 54.8% 38.6%
[libx264 # 0x206ed00] mb P I16..4: 0.4% 1.5% 0.2% P16..4: 8.7% 4.0% 1.9% 0.0% 0.0% skip:83.3%
[libx264 # 0x206ed00] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 4.2% 0.3% 0.0% direct: 0.0% skip:95.4% L0:37.2% L1:58.9% BI: 4.0%
[libx264 # 0x206ed00] 8x8 transform intra:66.2% inter:63.4%
[libx264 # 0x206ed00] coded y,uvDC,uvAC intra: 66.1% 65.6% 21.6% inter: 1.7% 1.1% 0.0%
[libx264 # 0x206ed00] i16 v,h,dc,p: 21% 26% 11% 42%
[libx264 # 0x206ed00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 23% 13% 5% 7% 8% 7% 7% 6%
[libx264 # 0x206ed00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 24% 9% 6% 7% 7% 6% 7% 7%
[libx264 # 0x206ed00] i8c dc,h,v,p: 46% 25% 20% 9%
[libx264 # 0x206ed00] Weighted P-Frames: Y:1.1% UV:0.0%
[libx264 # 0x206ed00] ref P L0: 66.0% 19.4% 12.0% 2.6% 0.0%
[libx264 # 0x206ed00] ref B L0: 87.2% 11.8% 1.0%
[libx264 # 0x206ed00] ref B L1: 95.2% 4.8%
[libx264 # 0x206ed00] kb/s:176.52
[aac # 0x204aa00] Qavg: 247.398

hstack doesn't sync by timestamps. You'll need to pad the delayed video.
ffmpeg \
-i smaller.mp4 \
-i bigger.mp4 \
-filter_complex \
"[0]tpad=start_duration=17[left];\
[left][1]hstack=inputs=2;\
[0]adelay=17s|17s[lefta];[lefta][1]amix=2" \
-c:v libx264 -crf 23 out.mp4

Related

FFmpeg scaling issue

I am trying to down scale a video from 607x1080 to 440 width with the height automatically being calculated using the following command. It does scale the video but not to the specified dimension. The video is scaled to 216x384 even though the output below indicates 440x384.
ffmpeg -i video.mp4 -vf scale=440:-2 -c:v libx264 -c:a aac -y video-out.mp4
The output is as follows:
ffmpeg version N-87043-gf0f48884b0-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.4.0 (Debian 6.4.0-2) 20170724
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
libavutil 55. 74.100 / 55. 74.100
libavcodec 57.103.100 / 57.103.100
libavformat 57. 77.100 / 57. 77.100
libavdevice 57. 7.101 / 57. 7.101
libavfilter 6.100.100 / 6.100.100
libswscale 4. 7.103 / 4. 7.103
libswresample 2. 8.100 / 2. 8.100
libpostproc 54. 6.100 / 54. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2017-12-13T19:49:15.000000Z
encoder : HandBrake 1.0.7 2017040900
Duration: 00:00:04.37, start: 0.000000, bitrate: 10080 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1238x1080 [SAR 27:55 DAR 619:1100], 10244 kb/s, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2017-12-13T19:49:15.000000Z
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s (default)
Metadata:
creation_time : 2017-12-13T19:49:15.000000Z
handler_name : Stereo
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 # 0x5aef920] using SAR=1215/2474
[libx264 # 0x5aef920] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 0x5aef920] profile High, level 2.2
[libx264 # 0x5aef920] 264 - core 152 r19 ba24899 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - 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=12 lookahead_threads=2 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
Output #0, mp4, to 'video-out.mp4':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.77.100
Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 440x384 [SAR 7428:15125 DAR 619:1100], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
creation_time : 2017-12-13T19:49:15.000000Z
handler_name : VideoHandler
encoder : Lavc57.103.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2017-12-13T19:49:15.000000Z
handler_name : Stereo
encoder : Lavc57.103.100 aac
frame= 121 fps=0.0 q=29.0 size= 0kB time=00:00:04.33 bitrate= 0.1kbits/s speed=8.65x
frame= 129 fps=0.0 q=-1.0 Lsize= 255kB time=00:00:04.37 bitrate= 478.0kbits/s speed=6.81x
video:248kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.344491%
[libx264 # 0x5aef920] frame I:1 Avg QP:22.07 size: 5065
[libx264 # 0x5aef920] frame P:52 Avg QP:23.68 size: 4248
[libx264 # 0x5aef920] frame B:76 Avg QP:24.30 size: 361
[libx264 # 0x5aef920] consecutive B-frames: 12.4% 20.2% 20.9% 46.5%
[libx264 # 0x5aef920] mb I I16..4: 13.1% 81.7% 5.2%
[libx264 # 0x5aef920] mb P I16..4: 2.1% 5.2% 1.5% P16..4: 36.4% 12.2% 8.2% 0.0% 0.0% skip:34.4%
[libx264 # 0x5aef920] mb B I16..4: 0.2% 0.2% 0.1% B16..8: 16.3% 1.3% 0.2% direct: 0.5% skip:81.2% L0:42.2% L1:52.1% BI: 5.8%
[libx264 # 0x5aef920] 8x8 transform intra:62.0% inter:70.3%
[libx264 # 0x5aef920] coded y,uvDC,uvAC intra: 52.3% 45.2% 20.0% inter: 13.3% 10.0% 2.6%
[libx264 # 0x5aef920] i16 v,h,dc,p: 17% 48% 11% 24%
[libx264 # 0x5aef920] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 8% 35% 23% 5% 3% 2% 6% 3% 14%
[libx264 # 0x5aef920] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 8% 29% 16% 6% 7% 4% 12% 4% 14%
[libx264 # 0x5aef920] i8c dc,h,v,p: 64% 26% 7% 2%
[libx264 # 0x5aef920] Weighted P-Frames: Y:32.7% UV:5.8%
[libx264 # 0x5aef920] ref P L0: 55.7% 22.1% 15.8% 5.8% 0.7%
[libx264 # 0x5aef920] ref B L0: 77.8% 15.9% 6.3%
[libx264 # 0x5aef920] ref B L1: 97.6% 2.4%
[libx264 # 0x5aef920] kb/s:471.40
[aac # 0x5b7e180] Qavg: 65536.000
I did some searching and learned this may be an issue scaling with libx264 codec and the input width being an odd number? If so, is there a workaround so get the video to scale to the specified size? Thank you.
The scaling is "correct", but the video has a pixel or sample aspect ratio below 1 (27:55 ~= 0.491) so the video's effective display ratio is not the same as the ratio of width to height of the stored pixels.
Use the -vf expression below
-vf scale=440:2*trunc(ow/dar/2),setsar=1
Besides the scale, I reset the SAR to 1.

FFMPEG - Concatenate 2 MP4 Files, one has video and audio and the other has only audio

I am trying to merge 2 mp4 files using FFMPEG. One of these files has both video and audio (track1.mp4), while the other one has only audio (track2.mp4). The names of these files are listed in a text file called 'filesToMerge.txt' in the following manner:
file 'track1.mp4'
file 'track2.mp4'
I then execute the following ffmpeg command to merge them.
ffmpeg -f concat -i filesToMerge.txt -c copy output.mp4
However, the concatenated file that is generated consists of only the first file that is listed in filesToMerge.txt. That is, if track1.mp4 (which has both video and audio) is the first file in the list, then only that file makes up output.mp4 (the concatenated file produced) and vice versa.
I would like for both files to be in output.mp4. I am using Ubuntu 14.04 (if that helps). How can I solve this problem?
When I run this command
ffmpeg -i track1.mp4 -i track2.mp4 output.mp4
I get the following
ffmpeg version N-76944-g15206ff Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libdcadec --enable-libfreetype --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab
libavutil 55. 9.100 / 55. 9.100
libavcodec 57. 16.101 / 57. 16.101
libavformat 57. 19.100 / 57. 19.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 17.100 / 6. 17.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'track1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Duration: 00:00:10.76, start: 0.023220, bitrate: 351 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 800x400 [SAR 400:533 DAR 800:533], 181 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 194 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'track2.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf52.32.0
Duration: 00:00:32.21, start: 0.000000, bitrate: 46 kb/s
Stream #1:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 43 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
[libx264 # 0x3950ce0] using SAR=400/533
[libx264 # 0x3950ce0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 # 0x3950ce0] profile High, level 3.0
[libx264 # 0x3950ce0] 264 - core 142 r2491 24e4fed - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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=1 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
Output #0, mp4, to 'output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.19.100
Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 800x400 [SAR 400:533 DAR 800:533], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.16.101 libx264
Stream #0:1(und): Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.16.101 libfdk_aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
frame= 270 fps= 99 q=28.0 Lsize= 382kB time=00:00:10.72 bitrate= 291.9kbits/s dup=1 drop=0
video:230kB audio:143kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.482656%
[libx264 # 0x3950ce0] frame I:2 Avg QP:18.87 size:109452
[libx264 # 0x3950ce0] frame P:68 Avg QP:15.09 size: 171
[libx264 # 0x3950ce0] frame B:200 Avg QP:23.33 size: 23
[libx264 # 0x3950ce0] consecutive B-frames: 1.1% 0.0% 1.1% 97.8%
[libx264 # 0x3950ce0] mb I I16..4: 11.0% 39.6% 49.5%
[libx264 # 0x3950ce0] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 5.9% 0.1% 0.0% 0.0% 0.0% skip:93.9%
[libx264 # 0x3950ce0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.3% 0.0% 0.0% direct: 0.0% skip:99.7% L0:21.8% L1:78.2% BI: 0.0%
[libx264 # 0x3950ce0] 8x8 transform intra:39.7% inter:92.8%
[libx264 # 0x3950ce0] coded y,uvDC,uvAC intra: 92.0% 95.0% 73.2% inter: 0.1% 1.4% 0.0%
[libx264 # 0x3950ce0] i16 v,h,dc,p: 1% 30% 4% 66%
[libx264 # 0x3950ce0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 6% 55% 16% 2% 4% 2% 8% 2% 6%
[libx264 # 0x3950ce0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 18% 13% 7% 9% 7% 12% 6% 11%
[libx264 # 0x3950ce0] i8c dc,h,v,p: 44% 35% 10% 11%
[libx264 # 0x3950ce0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x3950ce0] ref P L0: 98.1% 0.2% 1.1% 0.5%
[libx264 # 0x3950ce0] ref B L0: 85.1% 13.2% 1.7%
[libx264 # 0x3950ce0] ref B L1: 93.6% 6.4%
[libx264 # 0x3950ce0] kb/s:174.10
So if I'm understanding correctly, you want the final outputted video file to play track1.mp4, which will have video and audio, and then track2.mp4, which will have only audio and display nothing? The following answer assumes this is your desired output.
I tried several solutions, namely splitting the audio from the video and concatenating the audios first, then remerging, and generating a black video to go with the track2.mp4. I couldn't convince either to work. The final solution I found that DID work well is a bash script on the ffmpeg wiki's Concatenate page.
The steps are very straightforward. Copy the bash script into a file named "mmcat" in the same directory as track1/2.mp4. Then run
chmod +x mmcat && ./mmcat track1.mp4 track2.mp4 final.mp4
You should now have your desired file in final.mp4.
Note that this method does involve some transcoding, so you will theoretically lose some quality in doing so. Based on my experimentations, I don't believe this is avoidable since stream copying is only supported if the codecs exactly match, and you don't appear to be in that situation (your audio files have different bitrates, sample rates, etc).
Also note that whatever is in the final frame of video from track1 will be displayed, frozen, for the duration of track2. If you want it to go to black, you'd better make sure your final frame in track1 is a black frame. Doing so has been left as an exercise for OP.

Segment duration variation is higher than the +/- 50% allowed by DASH-IF

I am implement a proof of concept page with video player that uses DASH. I am having a difficult time getting the video right and I am not sure whether this is an encoding issue or MP4Box issue.
Since I am working on Ubuntu I had to change a few parameters for ffmpeg, but according to what I read this should be fine:
~/ffmpeg/ffmpeg -c:a aac -ar 44100 -ac 1 -codec:v libx264 \
-profile:v baseline -level 13 -b:v 2000k video_transcoded.mp4 -i video.mp4
Then to create the MPD I am running this:
MP4Box -dash 10000 -dash-profile live \
-segment-name video_transcoded video_transcoded.mp4
I am getting this response at the end, which might be why no player will play my video:
[DASH] two languages in adaptation set: und will be kept eng will be ignored
DASHing file video_transcoded.mp4
[DASH]: Segment duration variation is higher than the +/- 50% allowed by DASH-IF (min 1.044, max 10.448) - please reconsider encoding
Here is the output of ffmpeg:
ffmpeg version N-53477-g689211d-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.3.1 (Debian 5.3.1-10) 20160224
configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --enable-librtmp --enable-libmfx --cc=gcc
libavutil 55. 19.100 / 55. 19.100
libavcodec 57. 28.100 / 57. 28.100
libavformat 57. 28.100 / 57. 28.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 39.102 / 6. 39.102
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'gladiator.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isomavc1
creation_time : 2013-02-12 19:14:56
Duration: 02:50:56.98, start: 0.000000, bitrate: 923 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x544 [SAR 1:1 DAR 40:17], 823 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
Metadata:
creation_time : 2013-02-12 19:14:56
handler_name : 2000.Extended.Remastered.720p.BluRay.x264-HDEVO.mkv.264#trackID=1:fps=23.976#GPAC0.5.1-DEV-rev4283
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 95 kb/s (default)
Metadata:
creation_time : 2013-02-12 15:32:26
handler_name : Sound Media Handler
[libx264 # 0xaf12920] using SAR=1/1
[libx264 # 0xaf12920] frame MB size (80x34) > level limit (396)
[libx264 # 0xaf12920] DPB size (3 frames, 8160 mbs) > level limit (0 frames, 2376 mbs)
[libx264 # 0xaf12920] MB rate (65214) > level limit (11880)
[libx264 # 0xaf12920] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 0xaf12920] profile Constrained Baseline, level 1.3
[libx264 # 0xaf12920] 264 - core 148 r236 a01e339 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=2000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'gladiator2.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isomavc1
encoder : Lavf57.28.100
Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x544 [SAR 1:1 DAR 40:17], q=-1--1, 2000 kb/s, 23.98 fps, 24k tbn, 23.98 tbc (default)
Metadata:
creation_time : 2013-02-12 19:14:56
handler_name : 2000.Extended.Remastered.720p.BluRay.x264-HDEVO.mkv.264#trackID=1:fps=23.976#GPAC0.5.1-DEV-rev4283
encoder : Lavc57.28.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 0 vbv_delay: -1
Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, mono, fltp, 69 kb/s (default)
Metadata:
creation_time : 2013-02-12 15:32:26
handler_name : Sound Media Handler
encoder : Lavc57.28.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
After transcoding is completed I get this:
frame= 132 fps= 15 q=25.0 Lsize= 1112kB time=00:00:05.31 bitrate=1713.0kbits/s speed=0.603x
video:1062kB audio:45kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.414602%
[libx264 # 0xab63de0] frame I:1 Avg QP:21.29 size:121187
[libx264 # 0xab63de0] frame P:131 Avg QP:23.40 size: 7372
[libx264 # 0xab63de0] mb I I16..4: 9.2% 0.0% 90.8%
[libx264 # 0xab63de0] mb P I16..4: 0.9% 0.0% 0.3% P16..4: 37.2% 7.0% 1.8% 0.0% 0.0% skip:52.7%
[libx264 # 0xab63de0] final ratefactor: 21.58
[libx264 # 0xab63de0] coded y,uvDC,uvAC intra: 48.8% 72.2% 30.7% inter: 8.9% 14.6% 0.8%
[libx264 # 0xab63de0] i16 v,h,dc,p: 28% 33% 18% 21%
[libx264 # 0xab63de0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 16% 15% 8% 7% 8% 6% 12% 6%
[libx264 # 0xab63de0] i8c dc,h,v,p: 52% 21% 19% 8%
[libx264 # 0xab63de0] ref P L0: 92.9% 5.2% 1.8%
[libx264 # 0xab63de0] kb/s:1646.80
[aac # 0xab64c40] Qavg: 112.650
What can I do to make this work?

Two nearly identical ffmpeg commands, one works, the other freezes up

In both of these examples, I'm passing two inputs to ffmpeg applying a filter to the first input, and outputting it all to a .mp4.
Example 1
ffmpeg -y -threads 4 -ss 23.536 -t 44.854 -i .tmp/processing/vid-one.webm -ss 13.516 -t 54.874 -i .tmp/processing/vid-two.webm -filter_complex "[0]scale=320:-1,pad=2*iw:2*ih:0:120[left];[1]scale=320:-1[right];[left][right]overlay=main_w/2:120,scale=640:480" -shortest .tmp/processing/temp-23536-68390.mp4
Example 2
ffmpeg -y -threads 4 -ss 68.39 -t 3.646 -i .tmp/processing/vid-one.webm -ss 58.37 -t 13.666 -i .tmp/processing/vid-two.webm -filter_complex "[0]scale=320:-1,pad=2*iw:2*ih:0:120[left];[1]scale=320:-1[right];[left][right]overlay=main_w/2:120,scale=640:480" -shortest .tmp/processing/temp-68390-72036.mp4
In the logging output I can get an idea of where it gets hung up.
Output Example 1
the output gets to this frame= line and it updates the output like this
ffmpeg version 2.7.2 Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.7.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --enable-opencl --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-vda
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 41.100 / 56. 41.100
libavformat 56. 36.100 / 56. 36.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, matroska,webm, from '.tmp/processing/vid-one.webm':
Metadata:
encoder : libwebm-0.2.1.0
creation_time : 2015-09-27 18:54:09
Duration: 00:01:10.35, start: 0.000000, bitrate: 45 kb/s
Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
Stream #0:1(eng): Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 1k tbr, 1k tbn, 1k tbc (default)
Input #1, matroska,webm, from '.tmp/processing/vid-two.webm':
Metadata:
encoder : libwebm-0.2.1.0
creation_time : 2015-09-27 18:54:19
Duration: 00:00:59.58, start: 0.000000, bitrate: 356 kb/s
Stream #1:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
Stream #1:1(eng): Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 1k tbr, 1k tbn, 1k tbc (default)
[libx264 # 0x7faa59843e00] using SAR=1/1
[libx264 # 0x7faa59843e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 0x7faa59843e00] profile High, level 5.2
[libx264 # 0x7faa59843e00] 264 - core 144 r2533 c8a773e - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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
Output #0, mp4, to '.tmp/processing/temp-23536-68390.mp4':
Metadata:
encoder : Lavf56.36.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 1k fps, 16k tbn, 1k tbc (default)
Metadata:
encoder : Lavc56.41.100 libx264
Stream #0:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 48000 Hz, mono, s16, 128 kb/s (default)
Metadata:
encoder : Lavc56.41.100 libvo_aacenc
Stream mapping:
Stream #0:1 (vp8) -> scale (graph 0)
Stream #1:1 (vp8) -> scale (graph 0)
scale (graph 0) -> Stream #0:0 (libx264)
Stream #0:0 -> #0:1 (opus (native) -> aac (libvo_aacenc))
Press [q] to stop, [?] for help
Input stream #0:1 frame changed from size:640x480 fmt:yuv420p to size:320x240 fmt:yuv420p
Input stream #1:1 frame changed from size:640x480 fmt:yuv420p to size:1016x846 fmt:yuv420p
frame=13321 fps=268 q=33.0 size= 1321kB time=00:00:41.85 bitrate= 258.5kbits/s dup=13frame=25895 fps=258 q=33.0 size= 2268kB time=00:00:44.81 bitrate= 414.5kbits/s dup=25frame=35230 fps=244 q=33.0 size= 2936kB time=00:00:44.81 bitrate= 536.6kbits/s dup=35frame=41866 fps=231 q=33.0 size= 3552kB time=00:00:44.81 bitrate= 649.4kbits/s dup=41Past duration 0.999992 too large
frame=41868 fps=231 q=-1.0 Lsize= 4089kB time=00:00:44.85 bitrate= 746.8kbits/s dup=41862 drop=20
video:3108kB audio:479kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 13.986680%
[libx264 # 0x7faa59843e00] frame I:168 Avg QP:18.70 size: 12936
[libx264 # 0x7faa59843e00] frame P:10552 Avg QP:14.49 size: 37
[libx264 # 0x7faa59843e00] frame B:31148 Avg QP:17.67 size: 20
[libx264 # 0x7faa59843e00] consecutive B-frames: 0.8% 0.0% 0.0% 99.2%
[libx264 # 0x7faa59843e00] mb I I16..4: 40.0% 39.7% 20.3%
[libx264 # 0x7faa59843e00] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.2% 0.0% 0.0% 0.0% 0.0% skip:99.7%
[libx264 # 0x7faa59843e00] 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: 7.4% L1:92.6% BI: 0.0%
[libx264 # 0x7faa59843e00] 8x8 transform intra:39.8% inter:54.0%
[libx264 # 0x7faa59843e00] coded y,uvDC,uvAC intra: 31.6% 26.7% 16.9% inter: 0.0% 0.1% 0.0%
[libx264 # 0x7faa59843e00] i16 v,h,dc,p: 68% 22% 9% 1%
[libx264 # 0x7faa59843e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 45% 14% 1% 3% 5% 2% 5% 3%
[libx264 # 0x7faa59843e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 47% 10% 1% 2% 2% 3% 2% 3%
[libx264 # 0x7faa59843e00] i8c dc,h,v,p: 73% 13% 12% 2%
[libx264 # 0x7faa59843e00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x7faa59843e00] ref P L0: 99.3% 0.4% 0.1% 0.2%
[libx264 # 0x7faa59843e00] ref B L0: 68.7% 31.3%
[libx264 # 0x7faa59843e00] ref B L1: 99.3% 0.7%
[libx264 # 0x7faa59843e00] kb/s:608.06
Output Example 2
When it gets to the frame= line, it hangs
ffmpeg version 2.7.2 Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.7.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --enable-opencl --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-vda
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 41.100 / 56. 41.100
libavformat 56. 36.100 / 56. 36.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, matroska,webm, from '.tmp/processing/vid-one.webm':
Metadata:
encoder : libwebm-0.2.1.0
creation_time : 2015-09-27 18:54:09
Duration: 00:01:10.35, start: 0.000000, bitrate: 45 kb/s
Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
Stream #0:1(eng): Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 1k tbr, 1k tbn, 1k tbc (default)
Input #1, matroska,webm, from '.tmp/processing/vid-two.webm':
Metadata:
encoder : libwebm-0.2.1.0
creation_time : 2015-09-27 18:54:19
Duration: 00:00:59.58, start: 0.000000, bitrate: 356 kb/s
Stream #1:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
Stream #1:1(eng): Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 1k tbr, 1k tbn, 1k tbc (default)
[libx264 # 0x7fdb4a802600] using SAR=1/1
[libx264 # 0x7fdb4a802600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 0x7fdb4a802600] profile High, level 5.2
[libx264 # 0x7fdb4a802600] 264 - core 144 r2533 c8a773e - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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
Output #0, mp4, to '.tmp/processing/temp-68390-72036.mp4':
Metadata:
encoder : Lavf56.36.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 1k fps, 16k tbn, 1k tbc (default)
Metadata:
encoder : Lavc56.41.100 libx264
Stream #0:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 48000 Hz, mono, s16, 128 kb/s (default)
Metadata:
encoder : Lavc56.41.100 libvo_aacenc
Stream mapping:
Stream #0:1 (vp8) -> scale (graph 0)
Stream #1:1 (vp8) -> scale (graph 0)
scale (graph 0) -> Stream #0:0 (libx264)
Stream #0:0 -> #0:1 (opus (native) -> aac (libvo_aacenc))
Press [q] to stop, [?] for help
Input stream #0:1 frame changed from size:640x480 fmt:yuv420p to size:320x240 fmt:yuv420p
Input stream #1:1 frame changed from size:640x480 fmt:yuv420p to size:1016x846 fmt:yuv420p
frame= 0 fps=0.0 q=0.0 Lsize= 17kB time=00:00:01.97 bitrate= 71.8kbits/s
version: ffmpeg version 2.7.2
This problem comes from frame size changing: "Input stream #0:1 frame changed from size:640x480 fmt:yuv420p to size:320x240 fmt:yuv420p"
Scale your input video to the same size first, then do the overlay stuff.

FFMpeg Concat Filter - Setting start position for file

I want to concat two video files using the concat filter. The first file has to be included fully, whereas the second video must be included from the 10th second. Do I need to first create an intermediate file starting from the 10th second, or can I do it in one step?
The command I am using is
/usr/local/bin/ffmpeg -i intro.mp4 -i input.mp4 -filter_complex '[0:v] scale=720:576 [in1]; [1:v] scale=720:576 [in2]; [in1][in2] concat [v]; [0:a][1:a] concat=v=0:a=1 [a]' -map '[v]' -map '[a]' output.mp4
I tried specifying -ss after -i input.mp4, but it is applied on the final output file.
iMac:files joyce$ /usr/local/bin/ffmpeg -i intro.mp4 -i input.mp4 -filter_complex '[0:v] scale=720:576 [in1]; [1:v] scale=720:576 [in2]; [in1][in2] concat [v]; [0:a][1:a] concat=v=0:a=1 [a]' -map '[v]' -map '[a]' output.mp4
ffmpeg version 2.1.4 Copyright (c) 2000-2014 the FFmpeg developers
built on Mar 22 2014 16:19:43 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.1.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libfdk-aac
libavutil 52. 48.101 / 52. 48.101
libavcodec 55. 39.101 / 55. 39.101
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libavresample 1. 1. 0 / 1. 1. 0
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'intro.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.19.104
Duration: 00:00:03.05, start: 0.046440, bitrate: 1304 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080, 1167 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 132 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.19.104
episode_sort : 1
season_number : 1
media_type : 9
hd_video : 0
Duration: 00:00:45.43, start: 0.042667, bitrate: 906 kb/s
Stream #1:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 720x576 [SAR 1:1 DAR 5:4], 774 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #1:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : SoundHandler
File 'output.mp4' already exists. Overwrite ? [y/N] y
[libx264 # 0x7fa9a8828e00] using SAR=1/1
[libx264 # 0x7fa9a8828e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 # 0x7fa9a8828e00] profile High, level 3.1
[libx264 # 0x7fa9a8828e00] 264 - core 125 - 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
Output #0, mp4, to 'output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.19.104
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x576 [SAR 1:1 DAR 5:4], q=-1--1, 30k tbn, 29.97 tbc (default)
Stream #0:1: Audio: aac (libfaac) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s (default)
Stream mapping:
Stream #0:0 (h264) -> scale
Stream #0:1 (aac) -> concat:in0:a0
Stream #1:0 (h264) -> scale
Stream #1:1 (aac) -> concat:in1:a0
concat -> Stream #0:0 (libx264)
concat -> Stream #0:1 (libfaac)
Press [q] to stop, [?] for help
frame= 1453 fps= 42 q=-1.0 Lsize= 4536kB time=00:00:48.50 bitrate= 766.1kbits/s dup=227 drop=0
video:3796kB audio:691kB subtitle:0 global headers:0kB muxing overhead 1.102067%
[libx264 # 0x7fa9a8828e00] frame I:31 Avg QP:17.02 size: 14953
[libx264 # 0x7fa9a8828e00] frame P:764 Avg QP:24.14 size: 3677
[libx264 # 0x7fa9a8828e00] frame B:658 Avg QP:28.17 size: 933
[libx264 # 0x7fa9a8828e00] consecutive B-frames: 36.4% 6.2% 10.3% 47.1%
[libx264 # 0x7fa9a8828e00] mb I I16..4: 40.4% 32.3% 27.3%
[libx264 # 0x7fa9a8828e00] mb P I16..4: 6.6% 4.0% 1.1% P16..4: 25.2% 5.7% 2.3% 0.0% 0.0% skip:55.0%
[libx264 # 0x7fa9a8828e00] mb B I16..4: 0.8% 0.4% 0.2% B16..8: 24.5% 1.7% 0.2% direct: 0.5% skip:71.6% L0:50.7% L1:45.5% BI: 3.9%
[libx264 # 0x7fa9a8828e00] 8x8 transform intra:33.3% inter:59.0%
[libx264 # 0x7fa9a8828e00] coded y,uvDC,uvAC intra: 26.4% 41.2% 8.0% inter: 5.6% 7.9% 0.2%
[libx264 # 0x7fa9a8828e00] i16 v,h,dc,p: 46% 29% 8% 17%
[libx264 # 0x7fa9a8828e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 19% 28% 3% 3% 4% 3% 4% 3%
[libx264 # 0x7fa9a8828e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 22% 13% 4% 6% 7% 5% 5% 3%
[libx264 # 0x7fa9a8828e00] i8c dc,h,v,p: 57% 19% 20% 4%
[libx264 # 0x7fa9a8828e00] Weighted P-Frames: Y:1.8% UV:1.2%
[libx264 # 0x7fa9a8828e00] ref P L0: 73.2% 9.1% 11.7% 5.3% 0.7%
[libx264 # 0x7fa9a8828e00] ref B L0: 89.3% 8.9% 1.8%
[libx264 # 0x7fa9a8828e00] ref B L1: 95.3% 4.7%
[libx264 # 0x7fa9a8828e00] kb/s:641.26
I had placed the -ss argument after the -i option, which was why it was not applied correctly.
/usr/local/bin/ffmpeg -i intro.mp4 -i input.mp4 -ss 1.5 -filter_complex '[0:v] scale=720:576 [in1]; [1:v] scale=720:576 [in2]; [in1][in2] concat [v]; [0:a][1:a] concat=v=0:a=1 [a]' -map '[v]' -map '[a]' output.mp4
I tried placing it before -i option, and now it is working as expected.
/usr/local/bin/ffmpeg -i intro.mp4 -ss 1.5 -i input.mp4 -filter_complex '[0:v] scale=720:576 [in1]; [1:v] scale=720:576 [in2]; [in1][in2] concat [v]; [0:a][1:a] concat=v=0:a=1 [a]' -map '[v]' -map '[a]' output.mp4

Resources