I'm using ffmpeg in a node application with this command:
ffmpeg -seekable 0 -i http://127.0.0.1:8100/Mjpeg/1?authToken=xxx -video_size 1280x720 -r 30 -pix_fmt yuv420p -y D:\Video\pflyers\test.mp4
The encoding would stop after 28:53 every time. After some reading I figured I had to spawn the child instead of exec because of the large sterr output.
Before doing that I wanted to see if that was in fact the issue so I tried doing:
-nostats -hide_banner -loglevel panic
to avoid the large output to sterr. FFmpeg still stopped after 28:53. Further I tried to write the sterr to log.txt instead of using the above code. I did so adding this to the end:
2> log.txt
Still it would stop at 28:53.
Finally I tried running the command in cmd.exe resulting in the encoding stopping at 29:14.
What I realized comparing the outputs from ffmpeg run from node and run from cmd.exe was that the encoding stopped when the log.txt reached 388kB.
How can I fix this?
Here's the full output:
C:\Users\VossVind>ffmpeg -seekable 0 -i http://127.0.0.1:8100/Mjpeg/1?authToken=xxx -video_size 1280x720 -r 30 -pix_fmt yuv420p -y D:\Video\pflyers\test.mp4
ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mpjpeg, from 'http://127.0.0.1:8100/Mjpeg/1?authToken=xxx':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 96:96 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler # 0000019639b27fc0] deprecated pixel format used, make sure you did set range correctly
[libx264 # 0000019639944040] using SAR=1/1
[libx264 # 0000019639944040] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 # 0000019639944040] profile High, level 3.1
[libx264 # 0000019639944040] 264 - core 152 r2851 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=18 lookahead_threads=3 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 'D:\Video\pflyers\test.mp4':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc57.107.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
More than 1000 frames duplicated 114432kB time=00:03:17.80 bitrate=4739.3kbits/s dup=1000 drop=0 speed=0.95x
frame=52544 fps= 29 q=-1.0 Lsize= 1050136kB time=00:29:11.36 bitrate=4912.0kbits/s dup=8757 drop=0 speed=0.972x
video:1049508kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.059803%
[libx264 # 0000019639944040] frame I:261 Avg QP:20.59 size: 51862
[libx264 # 0000019639944040] frame P:15400 Avg QP:23.72 size: 33007
[libx264 # 0000019639944040] frame B:36883 Avg QP:24.55 size: 14989
[libx264 # 0000019639944040] consecutive B-frames: 0.9% 15.8% 2.5% 80.8%
[libx264 # 0000019639944040] mb I I16..4: 17.1% 82.1% 0.8%
[libx264 # 0000019639944040] mb P I16..4: 4.3% 48.4% 0.2% P16..4: 12.3% 7.5% 4.8% 0.0% 0.0% skip:22.5%
[libx264 # 0000019639944040] mb B I16..4: 2.7% 15.6% 0.0% B16..8: 22.3% 7.0% 1.8% direct: 3.8% skip:46.8% L0:52.3% L1:34.0% BI:13.8%
[libx264 # 0000019639944040] 8x8 transform intra:88.6% inter:92.9%
[libx264 # 0000019639944040] coded y,uvDC,uvAC intra: 59.4% 33.6% 2.6% inter: 19.3% 10.9% 0.6%
[libx264 # 0000019639944040] i16 v,h,dc,p: 57% 30% 12% 1%
[libx264 # 0000019639944040] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 18% 45% 2% 1% 1% 2% 2% 3%
[libx264 # 0000019639944040] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 52% 24% 12% 2% 2% 2% 2% 2% 2%
[libx264 # 0000019639944040] i8c dc,h,v,p: 63% 17% 20% 1%
[libx264 # 0000019639944040] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0000019639944040] ref P L0: 43.8% 7.5% 29.1% 19.6%
[libx264 # 0000019639944040] ref B L0: 71.8% 21.2% 7.0%
[libx264 # 0000019639944040] ref B L1: 93.9% 6.1%
[libx264 # 0000019639944040] kb/s:4908.78
Link to -v 48 verbose logging: https://pastebin.com/YwQx8bB2
Related
What I'm going to do: I'd like to join a set of (46) images and a (1.8 second) mp3 file to a mp4 file.
What works: When I use ffmpeg -framerate 25 -i img%09d.bmp -i audio.mp3 -c:v libx264 -vf scale=1280:-2,format=yuv420p -c:a copy -movflags +faststart output.mp4 (more or less the statement from https://superuser.com/a/852252 ), then ffmpeg creates the mp4 file and everything is fine: there is audio and video in a player like VLC.
What does not work: When I use a framerate of 30 (instead of 25), VLC shows video only, but does not play audio.
Question: What can I do to get it to work with framerate 30 (even when there are not enough images to cover the whole mp3 duration)?
Additional information:
When I copy images so that there are 60 of them (2 seconds at framerate 30), then VLC plays the mp4 with audio and video.
When I add the -shortest option like this ffmpeg -framerate 30 -i img%09d.bmp -i audio.mp3 -c:v libx264 -vf scale=1280:-2,format=yuv420p -c:a copy -movflags +faststart -shortest output.mp4 then VLC plays only audio and not video.
This is how the output for framerate 30 looks like. It is nearly the same for framerate 25 (but "30" instead of "25" and some other durations/times/ids).
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, image2, from 'img%09d.bmp':
Duration: 00:00:01.57, start: 0.000000, bitrate: N/A
Stream #0:0: Video: bmp, bgr24, 480x480, 30 fps, 30 tbr, 30 tbn, 30 tbc
[mp3 # 0x5557d053efc0] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'audio.mp3':
Duration: 00:00:01.03, start: 0.000000, bitrate: 32 kb/s
Stream #1:0: Audio: mp3, 24000 Hz, mono, fltp, 32 kb/s
File 'output.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (bmp (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[image2 # 0x5557d0536e00] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[libx264 # 0x5557d0550340] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 0x5557d0550340] profile High, level 4.0, 4:2:0, 8-bit
[libx264 # 0x5557d0550340] 264 - core 163 r3060 5db6aa6 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - 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=4 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:
encoder : Lavf58.76.100
Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, progressive), 1280x1280, q=2-31, 30 fps, 15360 tbn
Metadata:
encoder : Lavc58.134.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1: Audio: mp3 (mp4a / 0x6134706D), 24000 Hz, mono, fltp, 32 kb/s
[mp4 # 0x5557d054f640] Starting second pass: moving the moov atom to the beginning of the file
frame= 47 fps= 15 q=-1.0 Lsize= 259kB time=00:00:01.46 bitrate=1446.3kbits/s speed=0.454x
video:253kB audio:4kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.892266%
[libx264 # 0x5557d0550340] frame I:1 Avg QP:18.97 size:186405
[libx264 # 0x5557d0550340] frame P:16 Avg QP:19.79 size: 2808
[libx264 # 0x5557d0550340] frame B:30 Avg QP:23.61 size: 889
[libx264 # 0x5557d0550340] consecutive B-frames: 4.3% 0.0% 95.7% 0.0%
[libx264 # 0x5557d0550340] mb I I16..4: 3.0% 82.4% 14.6%
[libx264 # 0x5557d0550340] mb P I16..4: 0.1% 0.3% 0.0% P16..4: 7.1% 1.2% 1.4% 0.0% 0.0% skip:90.0%
[libx264 # 0x5557d0550340] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 10.5% 0.2% 0.1% direct: 0.2% skip:89.0% L0:22.9% L1:75.6% BI: 1.5%
[libx264 # 0x5557d0550340] 8x8 transform intra:81.7% inter:83.0%
[libx264 # 0x5557d0550340] coded y,uvDC,uvAC intra: 90.3% 94.8% 82.0% inter: 0.8% 1.6% 0.2%
[libx264 # 0x5557d0550340] i16 v,h,dc,p: 0% 46% 4% 50%
[libx264 # 0x5557d0550340] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 18% 10% 8% 9% 8% 10% 10% 14%
[libx264 # 0x5557d0550340] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 14% 7% 8% 15% 11% 10% 9% 10%
[libx264 # 0x5557d0550340] i8c dc,h,v,p: 53% 20% 15% 11%
[libx264 # 0x5557d0550340] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x5557d0550340] ref P L0: 86.6% 3.5% 7.2% 2.7%
[libx264 # 0x5557d0550340] ref B L0: 79.9% 19.4% 0.7%
[libx264 # 0x5557d0550340] kb/s:1317.43
I have a video of duration 14 seconds. I applied the setPTS filter to make it 3 times slow. So the total duration should be 42s (14*3). But the output gives a 49s long video. Here is the command:
ffmpeg -i video.mp4 -filter_complex "[0:v]setpts=3*PTS[v];[0:a]atempo=0.6,atempo=0.5[a]" -map "[v]" -map "[a]" output.mp4
What is wrong with this command? I tried it for different videos but all has the same weird issue. Any help will be appreciated. Regards.
Log:
ffmpeg version git-2020-08-31-4a11a6f Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 10.2.1 (GCC) 20200805
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --enable-librav1e --enable-libsvtav1 --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 58.100 / 56. 58.100
libavcodec 58.101.101 / 58.101.101
libavformat 58. 51.101 / 58. 51.101
libavdevice 58. 11.101 / 58. 11.101
libavfilter 7. 87.100 / 7. 87.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2018-11-20T06:28:07.000000Z
Duration: 00:00:14.72, start: 0.000000, bitrate: 688 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, unknown/bt470bg/unknown), 198x360 [SAR 1:1 DAR 11:20], 592 kb/s, 29.93 fps, 29.93 tbr, 29931 tbn, 59.86 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
Metadata:
creation_time : 2018-11-20T06:28:07.000000Z
handler_name : IsoMedia File Produced by Google, 5-11-2011
File 'output.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
Stream #0:0 (h264) -> setpts
Stream #0:1 (aac) -> atempo
setpts -> Stream #0:0 (libx264)
atempo -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[libx264 # 0000021e37f15340] using SAR=1/1
[libx264 # 0000021e37f15340] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0000021e37f15340] profile High, level 1.3, 4:2:0, 8-bit
[libx264 # 0000021e37f15340] 264 - core 161 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - 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 : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf58.51.101
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 198x360 [SAR 1:1 DAR 11:20], q=-1--1, 29.93 fps, 29931 tbn, 29.93 tbc (default)
Metadata:
encoder : Lavc58.101.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
encoder : Lavc58.101.101 aac
frame= 1313 fps=256 q=-1.0 Lsize= 2241kB time=00:00:44.11 bitrate= 416.2kbits/s dup=875 drop=0 speed=8.61x
video:1500kB audio:693kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.182632%
[libx264 # 0000021e37f15340] frame I:7 Avg QP:21.61 size: 18425
[libx264 # 0000021e37f15340] frame P:331 Avg QP:24.78 size: 3593
[libx264 # 0000021e37f15340] frame B:975 Avg QP:31.57 size: 223
[libx264 # 0000021e37f15340] consecutive B-frames: 0.8% 0.2% 1.6% 97.5%
[libx264 # 0000021e37f15340] mb I I16..4: 3.6% 31.1% 65.3%
[libx264 # 0000021e37f15340] mb P I16..4: 0.8% 1.3% 4.2% P16..4: 37.0% 29.0% 15.9% 0.0% 0.0% skip:11.7%
[libx264 # 0000021e37f15340] mb B I16..4: 0.0% 0.0% 0.2% B16..8: 8.4% 2.8% 1.2% direct: 0.4% skip:87.0% L0:61.8% L1:31.0% BI: 7.3%
[libx264 # 0000021e37f15340] 8x8 transform intra:22.3% inter:18.7%
[libx264 # 0000021e37f15340] coded y,uvDC,uvAC intra: 73.2% 85.7% 52.9% inter: 11.6% 7.4% 0.7%
[libx264 # 0000021e37f15340] i16 v,h,dc,p: 25% 33% 22% 19%
[libx264 # 0000021e37f15340] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 28% 19% 4% 5% 4% 7% 5% 7%
[libx264 # 0000021e37f15340] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 26% 13% 5% 7% 6% 7% 6% 7%
[libx264 # 0000021e37f15340] i8c dc,h,v,p: 38% 29% 22% 11%
[libx264 # 0000021e37f15340] Weighted P-Frames: Y:2.7% UV:0.3%
[libx264 # 0000021e37f15340] ref P L0: 86.1% 8.9% 3.6% 1.4% 0.1%
[libx264 # 0000021e37f15340] ref B L0: 94.7% 4.6% 0.8%
[libx264 # 0000021e37f15340] ref B L1: 99.3% 0.7%
[libx264 # 0000021e37f15340] kb/s:280.02
[aac # 0000021e3847c900] Qavg: 729.586
I have a bunch of images PNG files. I'm trying to make a slideshow with these using ffmpeg. The images are 3000*4000. These images don't have all the same aspect ratio.
Some are like these :
Some are like this :
I used the command :
ffmpeg -loop 1 -framerate 1/10 -i img%3d.png -i audio.wav -vf scale=w=3840:h=-1 -vcodec libx264 -crf 14 -r 60 -pix_fmt yuv420p -shortest output.mp4
It returns me this :
ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
configuration: --disable-decoder=amrnb --disable-decoder=libopenjpeg --disable-mips32r2 --disable-mips32r6 --disable-mips64r6 --disable-mipsdsp --disable-mipsdspr2 --disable-mipsfpu --disable-msa --disable-libopencv --disable-podpages --disable-stripping --enable-avfilter --enable-avresample --enable-gcrypt --enable-gnutls --enable-gpl --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libkvazaar --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx265 --enable-libxvid --enable-libzvbi --enable-nonfree --enable-opengl --enable-openssl --enable-postproc --enable-pthreads --enable-shared --enable-version3 --incdir=/usr/include/x86_64-linux-gnu --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --toolchain=hardened --enable-frei0r --enable-chromaprint --enable-libx264 --enable-libiec61883 --enable-libdc1394 --enable-vaapi --disable-opencl --enable-libmfx --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Input #0, image2, from 'img%3d.png':
Duration: 00:02:30.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgb24(pc), 4000x3000 [SAR 7087:7087 DAR 4:3], 0.10 tbr, 0.10 tbn, 0.10 tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, wav, from 'audio.wav':
Duration: 01:54:44.14, bitrate: 1536 kb/s
Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 # 0x55c1be935420] using SAR=1/1
[libx264 # 0x55c1be935420] frame MB size (240x180) > level limit (36864)
[libx264 # 0x55c1be935420] MB rate (2592000) > level limit (2073600)
[libx264 # 0x55c1be935420] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0x55c1be935420] profile High, level 5.2
[libx264 # 0x55c1be935420] 264 - core 150 - 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=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=14.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:
encoder : Lavf57.71.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p(progressive), 3840x2880 [SAR 1:1 DAR 4:3], q=-1--1, 60 fps, 15360 tbn, 60 tbc
Metadata:
encoder : Lavc57.89.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc57.89.100 aac
[image2 # 0x55c1be8edde0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
More than 1000 frames duplicated 5309kB time=00:00:09.13 bitrate=4762.0kbits/s dup=599 drop=0 speed=0.164x
More than 10000 frames duplicated 137722kB time=00:02:39.13 bitrate=7089.8kbits/s dup=9584 drop=0 speed=0.174x
More than 100000 frames duplicated429964kB time=00:27:39.13 bitrate=7060.5kbits/s dup=99434 drop=0 speed=0.173x
frame=413401 fps= 10 q=-1.0 Lsize= 5962186kB time=01:54:49.96 bitrate=7088.9kbits/s dup=413310 drop=0 speed=0.173x
video:5831116kB audio:117825kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.222641%
[libx264 # 0x55c1be935420] frame I:2068 Avg QP: 6.65 size:2816521
[libx264 # 0x55c1be935420] frame P:104040 Avg QP:10.85 size: 470
[libx264 # 0x55c1be935420] frame B:307293 Avg QP:16.51 size: 318
[libx264 # 0x55c1be935420] consecutive B-frames: 0.8% 0.0% 0.5% 98.7%
[libx264 # 0x55c1be935420] mb I I16..4: 7.3% 54.6% 38.1%
[libx264 # 0x55c1be935420] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.2% 0.0% 0.0% 0.0% 0.0% skip:99.8%
[libx264 # 0x55c1be935420] 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:49.5% L1:50.5% BI: 0.0%
[libx264 # 0x55c1be935420] 8x8 transform intra:54.6% inter:97.9%
[libx264 # 0x55c1be935420] coded y,uvDC,uvAC intra: 98.2% 92.7% 92.2% inter: 0.0% 0.0% 0.0%
[libx264 # 0x55c1be935420] i16 v,h,dc,p: 17% 12% 36% 35%
[libx264 # 0x55c1be935420] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 26% 13% 5% 6% 6% 9% 6% 11%
[libx264 # 0x55c1be935420] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 24% 11% 7% 9% 7% 10% 7% 11%
[libx264 # 0x55c1be935420] i8c dc,h,v,p: 40% 33% 18% 10%
[libx264 # 0x55c1be935420] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x55c1be935420] ref P L0: 99.6% 0.0% 0.4% 0.0%
[libx264 # 0x55c1be935420] ref B L0: 21.9% 78.1% 0.0%
[libx264 # 0x55c1be935420] ref B L1: 99.5% 0.5%
[libx264 # 0x55c1be935420] kb/s:6933.00
[aac # 0x55c1be938aa0] Qavg: 640.546
But the second image is distorted in the video (I can't show you because I don't have enough reputation to post more links).
So I would like to preserve the aspect ratio of each picture : the images shouldn't be distorted. What command should I use for this ?
Thanks in advance.
Looks like the input resolution is fixed but the orientation varies.
Use
ffmpeg -framerate 1/10 -i img%3d.png -i audio.wav \
-vf 'scale=3840:2880:force_original_aspect_ratio=decrease,pad=3840:2880:(ow-iw)/2:(oh-ih)/2,setsar=1' \
-c:v libx264 -crf 14 -r 25 -pix_fmt yuv420p -shortest output.mp4
(Since this is a slideshow, there's absolutely no point to encode at 60 fps.)
I have the following code:
var ffmpeg = require('fluent-ffmpeg');
var proc = new ffmpeg({source: media.file.path, nolog: false})
.withVideoCodec('libx264')
.withVideoBitrate(800)
.withAudioCodec('libvo_aacenc')
.withAudioBitrate('128k')
.withAudioChannels(2)
.toFormat('mp4')
.saveToFile(media.targetDir + media.getName() + '.' + '.mp4',
function (retcode, error) {
console.log('file has been converted succesfully');
});
fs.chmodSync(media.targetDir, '755');
This should (hopefully) convert an mov file to an mp4 file. However that is not the case. Instead it goes through the code without printing any error nor other console messages and just continue?
So my question is what have I done wrong?
I know it's not alot to go for but I'll be ready to answer any question you might have!
Here is a picture of the proc variable after the code has been executed:
Output of command
I ran the following command:
ffmpeg -i trim.F4A79C58-1141-412E-A713-2CF893F44055.MOV -c:v libx264 -vb 800k -c:a libfdk_aacenc -ab 128k -ac 2 test.mp4
And got the following output:
ffmpeg version N-76045-g97be5d4 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. 4.100 / 55. 4.100
libavcodec 57. 6.100 / 57. 6.100
libavformat 57. 4.100 / 57. 4.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 11.100 / 6. 11.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
[mov,mp4,m4a,3gp,3g2,mj2 # 0x3d494c0] moov atom not found
trim.F4A79C58-1141-412E-A713-2CF893F44055.MOV: Invalid data found when processing input
Attempted another file
Here is the output for when i attempted another file (the other file might have been broken)
ffmpeg version N-76045-g97be5d4 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. 4.100 / 55. 4.100
libavcodec 57. 6.100 / 57. 6.100
libavformat 57. 4.100 / 57. 4.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 11.100 / 6. 11.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.MOV':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2015-11-04 15:28:54
Duration: 00:00:02.21, start: 0.032948, bitrate: 751 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 91 kb/s (default)
Metadata:
creation_time : 2015-11-04 15:28:54
handler_name : Core Media Data Handler
Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt709/bt709), 272x480, 647 kb/s, 24.04 fps, 24.08 tbr, 600 tbn, 1200 tbc (default)
Metadata:
creation_time : 2015-11-04 15:28:54
handler_name : Core Media Data Handler
encoder : H.264
[libx264 # 0x356d660] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 0x356d660] profile High, level 2.1
[libx264 # 0x356d660] 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=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=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=800 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test.mp4':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
encoder : Lavf57.4.100
Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 272x480, q=-1--1, 800 kb/s, 24.08 fps, 18496 tbn, 24.08 tbc (default)
Metadata:
creation_time : 2015-11-04 15:28:54
handler_name : Core Media Data Handler
encoder : Lavc57.6.100 libx264
Stream #0:1(und): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s (default)
Metadata:
creation_time : 2015-11-04 15:28:54
handler_name : Core Media Data Handler
encoder : Lavc57.6.100 libvo_aacenc
Stream mapping:
Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (aac (native) -> aac (libvo_aacenc))
Press [q] to stop, [?] for help
frame= 54 fps=0.0 q=-1.0 Lsize= 226kB time=00:00:02.30 bitrate= 803.3kbits/s dup=1 drop=0
video:187kB audio:37kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.346419%
[libx264 # 0x356d660] frame I:1 Avg QP:18.97 size: 5651
[libx264 # 0x356d660] frame P:16 Avg QP:16.05 size: 6730
[libx264 # 0x356d660] frame B:37 Avg QP:17.38 size: 2086
[libx264 # 0x356d660] consecutive B-frames: 3.7% 11.1% 11.1% 74.1%
[libx264 # 0x356d660] mb I I16..4: 18.0% 56.5% 25.5%
[libx264 # 0x356d660] mb P I16..4: 3.5% 14.9% 5.9% P16..4: 37.2% 26.1% 10.0% 0.0% 0.0% skip: 2.5%
[libx264 # 0x356d660] mb B I16..4: 0.5% 1.3% 0.5% B16..8: 40.2% 8.6% 1.7% direct:18.9% skip:28.3% L0:47.4% L1:36.9% BI:15.7%
[libx264 # 0x356d660] final ratefactor: 15.06
[libx264 # 0x356d660] 8x8 transform intra:60.0% inter:47.9%
[libx264 # 0x356d660] coded y,uvDC,uvAC intra: 86.0% 88.2% 37.7% inter: 33.7% 48.0% 2.6%
[libx264 # 0x356d660] i16 v,h,dc,p: 27% 10% 44% 19%
[libx264 # 0x356d660] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 14% 36% 4% 4% 6% 5% 5% 5%
[libx264 # 0x356d660] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 16% 22% 5% 7% 8% 5% 5% 3%
[libx264 # 0x356d660] i8c dc,h,v,p: 50% 18% 25% 7%
[libx264 # 0x356d660] Weighted P-Frames: Y:6.2% UV:0.0%
[libx264 # 0x356d660] ref P L0: 66.8% 11.1% 14.9% 6.6% 0.6%
[libx264 # 0x356d660] ref B L0: 92.8% 6.0% 1.1%
[libx264 # 0x356d660] ref B L1: 97.6% 2.4%
[libx264 # 0x356d660] kb/s:679.79
Using FFmpeg, I'm trying to do some filtering operations on one input video to scale it (out1), scale and trim it (out2).
This is the command I'm using:
ffmpeg -y \
-i "Robotica_1080.mkv" \
-filter_complex "[0:v]split=2[v1][v2]; \
[v1]scale=640:360,setpts=PTS-STARTPTS[vout1]; \
[v2]trim=10:15,scale=640:360,setpts=PTS-STARTPTS[vout2]; \
[0:a]asplit=2[a1][a2]; \
[a1]anull,asetpts=PTS-STARTPTS[aout1]; \
[a2]atrim=10:15,asetpts=PTS-STARTPTS[aout2]; \
[vout1][aout1]concat=n=1:v=1:a=1[out1]; \
[vout2][aout2]concat=n=1:v=1:a=1[out2]" \
-map "[out1]" "1.mp4" \
-map "[out2]" "2.mp4"
1.mp4 is ok while 2.mp4 lasts 5 seconds as expected but without audio at all (the QuickTime inspector doesn't write the audio codec)
I tried to remove the trim/atrim filters, so the filter_complex parameter looked like this:
-filter_complex "[0:v]split=2[v1][v2]; \
[v1]scale=640:360[vout1]; \
[v2]scale=640:360[vout2]; \
[0:a]asplit=2[a1][a2]; \
[a1]anull[aout1]; \
[a2]anull[aout2]; \
[vout1][aout1]concat=n=1:v=1:a=1[out1]; \
[vout2][aout2]concat=n=1:v=1:a=1[out2]" \
but still no audio on 2.mp4
Can anyone give me a hint?
--EDIT--
This is the output from first ffmpeg command:
Mac-mini:~ Luca$ /Applications/XAMPP/xamppfiles/htdocs/MediaGallery/ffmpeg/ffmpeg -y \
> -i "/Users/Luca/Desktop/_TEMP UPLOAD/Video/Robotica_1080.mkv" \
> -filter_complex "[0:v]split=2[v1][v2]; \
> [v1]scale=640:360,setpts=PTS-STARTPTS[vout1]; \
> [v2]trim=10:15,scale=640:360,setpts=PTS-STARTPTS[vout2]; \
> [0:a]asplit=2[a1][a2]; \
> [a1]anull,asetpts=PTS-STARTPTS[aout1]; \
> [a2]atrim=10:15,asetpts=PTS-STARTPTS[aout2]; \
> [vout1][aout1]concat=n=1:v=1:a=1[out1]; \
> [vout2][aout2]concat=n=1:v=1:a=1[out2]" \
> -map "[out1]" "/Users/Luca/Downloads/1.mp4" \
> -map "[out2]" "/Users/Luca/Downloads/2.mp4"
ffmpeg version N-72460-gc5a07f1-tessus Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --as=yasm --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
libavutil 54. 23.101 / 54. 23.101
libavcodec 56. 40.100 / 56. 40.100
libavformat 56. 33.101 / 56. 33.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, matroska,webm, from '/Users/Luca/Desktop/_TEMP UPLOAD/Video/Robotica_1080.mkv':
Metadata:
encoder : libDivXMediaFormat 4.0.0.0578
Duration: 00:00:20.04, start: 0.000000, bitrate: 4282 kb/s
Stream #0:0(eng): Video: hevc (Main), yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 25 tbc (default)
Stream #0:1(en): Audio: aac (LC), 44100 Hz, stereo, fltp (default)
[swscaler # 0x7fb4d181c400] deprecated pixel format used, make sure you did set range correctly
[swscaler # 0x7fb4d185be00] deprecated pixel format used, make sure you did set range correctly
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
Last message repeated 1 times
[libx264 # 0x7fb4d183f400] using SAR=1/1
[libx264 # 0x7fb4d183f400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264 # 0x7fb4d183f400] profile High, level 3.0
[libx264 # 0x7fb4d183f400] 264 - core 142 - 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=3 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
[libx264 # 0x7fb4d184e400] using SAR=1/1
[libx264 # 0x7fb4d184e400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264 # 0x7fb4d184e400] profile High, level 3.0
[libx264 # 0x7fb4d184e400] 264 - core 142 - 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=3 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 '/Users/Luca/Downloads/1.mp4':
Metadata:
encoder : Lavf56.33.101
Stream #0:0: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s (default)
Metadata:
encoder : Lavc56.40.100 libvo_aacenc
Stream #0:1: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s
Metadata:
encoder : Lavc56.40.100 libvo_aacenc
Stream #0:2: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p(pc), 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:
encoder : Lavc56.40.100 libx264
Output #1, mp4, to '/Users/Luca/Downloads/2.mp4':
Metadata:
encoder : Lavf56.33.101
Stream #1:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p(pc), 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:
encoder : Lavc56.40.100 libx264
Stream mapping:
Stream #0:0 (hevc) -> split
Stream #0:1 (aac) -> asplit
concat:out:a0 -> Stream #0:0 (libvo_aacenc)
concat:out:a0 -> Stream #0:1 (libvo_aacenc)
concat:out:v0 -> Stream #0:2 (libx264)
concat:out:v0 -> Stream #1:0 (libx264)
Press [q] to stop, [?] for help
frame= 501 fps= 26 q=-1.0 Lq=-1.0 size= 1512kB time=00:00:19.97 bitrate= 620.1kbits/s
video:1385kB audio:392kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 # 0x7fb4d183f400] frame I:3 Avg QP:19.30 size: 3879
[libx264 # 0x7fb4d183f400] frame P:321 Avg QP:24.53 size: 3024
[libx264 # 0x7fb4d183f400] frame B:177 Avg QP:26.20 size: 825
[libx264 # 0x7fb4d183f400] consecutive B-frames: 40.7% 34.7% 5.4% 19.2%
[libx264 # 0x7fb4d183f400] mb I I16..4: 24.8% 65.9% 9.3%
[libx264 # 0x7fb4d183f400] mb P I16..4: 7.5% 10.5% 2.5% P16..4: 22.9% 7.4% 2.7% 0.0% 0.0% skip:46.5%
[libx264 # 0x7fb4d183f400] mb B I16..4: 0.4% 0.6% 0.3% B16..8: 17.2% 2.9% 0.7% direct: 0.9% skip:77.1% L0:37.2% L1:51.8% BI:11.0%
[libx264 # 0x7fb4d183f400] 8x8 transform intra:51.6% inter:69.2%
[libx264 # 0x7fb4d183f400] coded y,uvDC,uvAC intra: 40.2% 24.2% 1.1% inter: 8.5% 4.0% 0.0%
[libx264 # 0x7fb4d183f400] i16 v,h,dc,p: 9% 65% 1% 25%
[libx264 # 0x7fb4d183f400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 29% 16% 4% 6% 6% 7% 6% 6%
[libx264 # 0x7fb4d183f400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 34% 12% 3% 7% 6% 7% 4% 4%
[libx264 # 0x7fb4d183f400] i8c dc,h,v,p: 63% 25% 11% 1%
[libx264 # 0x7fb4d183f400] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x7fb4d183f400] ref P L0: 69.3% 11.5% 12.5% 6.7%
[libx264 # 0x7fb4d183f400] ref B L0: 82.4% 16.7% 0.8%
[libx264 # 0x7fb4d183f400] ref B L1: 98.6% 1.4%
[libx264 # 0x7fb4d183f400] kb/s:450.44
[libx264 # 0x7fb4d184e400] frame I:1 Avg QP:22.23 size: 6699
[libx264 # 0x7fb4d184e400] frame P:78 Avg QP:24.94 size: 2998
[libx264 # 0x7fb4d184e400] frame B:46 Avg QP:27.93 size: 1036
[libx264 # 0x7fb4d184e400] consecutive B-frames: 32.0% 56.0% 2.4% 9.6%
[libx264 # 0x7fb4d184e400] mb I I16..4: 53.5% 26.6% 19.9%
[libx264 # 0x7fb4d184e400] mb P I16..4: 9.8% 7.6% 3.1% P16..4: 25.0% 8.0% 2.8% 0.0% 0.0% skip:43.8%
[libx264 # 0x7fb4d184e400] mb B I16..4: 0.8% 0.5% 0.4% B16..8: 22.4% 3.5% 0.8% direct: 1.1% skip:70.4% L0:41.1% L1:48.0% BI:10.9%
[libx264 # 0x7fb4d184e400] 8x8 transform intra:36.1% inter:66.1%
[libx264 # 0x7fb4d184e400] coded y,uvDC,uvAC intra: 33.5% 24.6% 1.8% inter: 8.5% 3.8% 0.0%
[libx264 # 0x7fb4d184e400] i16 v,h,dc,p: 4% 82% 1% 13%
[libx264 # 0x7fb4d184e400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 40% 18% 3% 4% 4% 7% 3% 5%
[libx264 # 0x7fb4d184e400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 40% 13% 3% 5% 5% 6% 3% 4%
[libx264 # 0x7fb4d184e400] i8c dc,h,v,p: 54% 36% 8% 2%
[libx264 # 0x7fb4d184e400] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x7fb4d184e400] ref P L0: 60.6% 10.5% 17.5% 11.4%
[libx264 # 0x7fb4d184e400] ref B L0: 77.6% 22.0% 0.4%
[libx264 # 0x7fb4d184e400] ref B L1: 99.1% 0.9%
[libx264 # 0x7fb4d184e400] kb/s:461.15
In concat filter, "n" defines the number of segments. so n must be "2" in your filter, like this :
ffmpeg -y \
-i "Robotica_1080.mkv" \
-filter_complex "[0:v]split=2[v1][v2]; \
[v1]scale=640:360,setpts=PTS-STARTPTS[vout1]; \
[v2]trim=10:15,scale=640:360,setpts=PTS-STARTPTS[vout2]; \
[0:a]asplit=2[a1][a2]; \
[a1]anull,asetpts=PTS-STARTPTS[aout1]; \
[a2]atrim=10:15,asetpts=PTS-STARTPTS[aout2]; \
[vout1][aout1]concat=n=2:v=1:a=1[vout1][aout1]; \
[vout2][aout2]concat=n=2:v=1:a=1[vout2][aout2]" \
-map [vout1] -map [aout1] "1.mp4" \
-map [vout2] -map [aout2] "2.mp4"
or you can just map the audio in following command :
ffmpeg -y \
-i "Robotica_1080.mkv" \
-filter_complex "[0:v]split=2[v1][v2]; \
[v1]scale=640:360,setpts=PTS-STARTPTS[vout1]; \
[v2]trim=10:15,scale=640:360,setpts=PTS-STARTPTS[vout2]; \
[0:a]asplit=2[a1][a2]; \
[a1]anull,asetpts=PTS-STARTPTS[aout1]; \
[a2]atrim=10:15,asetpts=PTS-STARTPTS[aout2]"
-map [vout1] -map [aout1] "1.mp4" \
-map [vout2] -map [aout2] "2.mp4"