Can someone please tell me the proper syntax for combining the following filters into a single command? I can't seem to figure it out.
The following command is being used to scale the video.
ffmpeg -i input.mp4 -c:v libx264 -preset medium -crf 23 -vf scale="'if(gt(a,4/3),1280,-1)':'if(gt(a,4/3),-1,720)'" -movflags +faststart output.mp4 2>&1
Then, I use the following code to scale and apply the watermark.
ffmpeg -i input.mp4 -vf "movie=logo.png, scale=200:-1 [wm]; [in][wm] overlay=5:main_h-overlay_h-5 [out]" output.mp4 2>&1
They work fine independently but every attempt I've made to combine the filter commands has been unsuccessful. Some assistance would be appreciated.
LOG
# ffmpeg -i /var/www/html/site/public_html/media/input.mp4 \
> -i /var/www/html/site/public_html/media/logo.png \
> -c:v libx264 -preset medium -crf 23 -filter_complex "[0]scale='if(gt(a,4/3),1280,-1)':'if(gt(a,4/3),-1,720)'[main];[1]scale=200:-1[wm];[main][wm]overlay=5:main_h-overlay_h-5" -movflags +faststart \
> /var/www/html/site/public_html/media/output.mp4
ffmpeg version git-2015-04-08-b926f02 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-11)
configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/usr/bin --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libfreetype --enable-libtheora
libavutil 54. 22.101 / 54. 22.101
libavcodec 56. 34.100 / 56. 34.100
libavformat 56. 30.100 / 56. 30.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 13.101 / 5. 13.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/html/site/public_html/media/input.mp4':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2021-10-17 22:26:58
Duration: 00:00:02.40, start: 0.047891, bitrate: 2614 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 81 kb/s (default)
Metadata:
creation_time : 2021-10-17 22:26:58
handler_name : Core Media Data Handler
Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 716x1280, 2521 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc (default)
Metadata:
creation_time : 2021-10-17 22:26:58
handler_name : Core Media Data Handler
encoder : H.264
Input #1, png_pipe, from '/var/www/html/site/public_html/media/logo.png':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: png, rgba, 468x100, 25 tbr, 25 tbn, 25 tbc
File '/var/www/html/site/public_html/media/output.mp4' already exists. Overwrite ? [y/N] y
[libx264 # 0x30008a0] width not divisible by 2 (403x720)
Output #0, mp4, to '/var/www/html/site/public_html/media/output.mp4':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, 30 fps (default)
Metadata:
encoder : Lavc56.34.100 libx264
Stream #0:1(und): Audio: aac, 0 channels, 128 kb/s (default)
Metadata:
creation_time : 2021-10-17 22:26:58
handler_name : Core Media Data Handler
encoder : Lavc56.34.100 libfdk_aac
Stream mapping:
Stream #0:1 (h264) -> scale (graph 0)
Stream #1:0 (png) -> scale (graph 0)
overlay (graph 0) -> Stream #0:0 (libx264)
Stream #0:0 -> #0:1 (aac (native) -> aac (libfdk_aac))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Combined command:
ffmpeg -i input.mp4 -i logo.png -c:v libx264 -preset medium -crf 23 -filter_complex "[0]scale='if(gt(a,4/3),1280,-2)':'if(gt(a,4/3),-2,720)'[main];[1]scale=200:-1[wm];[main][wm]overlay=5:main_h-overlay_h-5" -c:a copy -movflags +faststart output.mp4
See FFmpeg Filtering Intro.
Is this a bug, or expected behaviour? When converting materials from PAL to NTSC I invoke atempo as follows:
-map 0:a:? -af atempo=24000/25025 ^
-c:a pcm_s24le
I use this in a windows batch file (hence the caret) as a catch-all for all files that need to be converted, not having to deal with how many audio channels might be present or in what order.
However, when my input was a broadcast MXF with 10channel mono audio (1 per stream) it introduced wild phasing between the tracks.
Merging the tracks into a single stream to be processed by atempo resulted in no phasing.
-filter_complex "[0:a:0][0:a:1][0:a:2][0:a:3][0:a:4][0:a:5][0:a:6][0:a:7][0:a:8][0:a:9] amerge=inputs=10, atempo=24000/25025[FRC]" ^
-map "[FRC]" -c:a pcm_s24le
Is this expected behaviour? I can't see any documentation detailing the need to first use amerge before invoking atempo.
If indeed this step is necessary, is there a way to "wildcard" the amerge operation so that I don't have to manually enter all the audio channels, and then the "inputs="? This would allow me to make it more universal.
This is my first question on stack overflow, so please be gentle. I've come here to find so many answers to my FFMPEG questions in the past--but this seems to be an edge case I can't get much detail on.
Thanks!
EDIT:
This output using the wildcard produces phasing:
C:\Windows>ffmpeg -ss 00:05:13.0 -r 24000/1001 -i "\\bdfs11\array21\Eps101_1920x1080_20_51_DV_CC_25fps_20210622.mov" -t 00:00:22.0 -map 0:v:0 -c:v mpeg2video -profile:v 0 -level:v 2 -b:v 50000k -minrate 50000k -maxrate 50000k -pix_fmt yuv422p -vtag xd5d -force_key_frames "expr:gte(t,n_forced*1)" -streamid 0:481 -streamid 1:129 -map 0:a:? -af atempo=24000/25025 -c:a pcm_s24le "R:\2_SERIES\%~n1_25to23976_works.%Container%" -y
ffmpeg version N-94566-gddd92ba2c6 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.1.1 (GCC) 20190807
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-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-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 33.100 / 56. 33.100
libavcodec 58. 55.100 / 58. 55.100
libavformat 58. 30.100 / 58. 30.100
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 58.100 / 7. 58.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
[mov,mp4,m4a,3gp,3g2,mj2 # 06ea4cc0] Could not find codec parameters for stream 12 (Subtitle: none (c708 / 0x38303763), 1920x1080, 21 kb/s): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Guessed Channel Layout for Input Stream #0.2 : mono
Guessed Channel Layout for Input Stream #0.3 : mono
Guessed Channel Layout for Input Stream #0.4 : mono
Guessed Channel Layout for Input Stream #0.5 : mono
Guessed Channel Layout for Input Stream #0.6 : mono
Guessed Channel Layout for Input Stream #0.7 : mono
Guessed Channel Layout for Input Stream #0.8 : mono
Guessed Channel Layout for Input Stream #0.9 : mono
Guessed Channel Layout for Input Stream #0.10 : mono
Guessed Channel Layout for Input Stream #0.11 : mono
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '\\bdfs11\array21\Eps101_1920x1080_20_51_DV_CC_25fps_20210622.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2021-06-22T17:39:50.000000Z
Duration: 00:59:08.16, start: 0.000000, bitrate: 217983 kb/s
Stream #0:0(eng): Video: prores (HQ) (apch / 0x68637061), yuv422p10le(tv, bt709, progressive), 1920x1080, 206438 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Video Media Handler
encoder : Apple ProRes 422 HQ
timecode : 00:59:59:00
Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
rotate : 0
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Time Code Media Handler
reel_name : untitled
timecode : 00:59:59:00
Stream #0:2(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:3(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:4(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:5(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:6(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:7(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:8(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:9(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:10(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:11(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:12(eng): Subtitle: none (c708 / 0x38303763), 1920x1080, 21 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Closed Caption Media Handler
Stream mapping:
Stream #0:0 -> #0:0 (prores (native) -> mpeg2video (native))
Stream #0:2 -> #0:1 (pcm_s24le (native) -> pcm_s24le (native))
Stream #0:3 -> #0:2 (pcm_s24le (native) -> pcm_s24le (native))
Stream #0:4 -> #0:3 (pcm_s24le (native) -> pcm_s24le (native))
Stream #0:5 -> #0:4 (pcm_s24le (native) -> pcm_s24le (native))
Stream #0:6 -> #0:5 (pcm_s24le (native) -> pcm_s24le (native))
Stream #0:7 -> #0:6 (pcm_s24le (native) -> pcm_s24le (native))
Stream #0:8 -> #0:7 (pcm_s24le (native) -> pcm_s24le (native))
Stream #0:9 -> #0:8 (pcm_s24le (native) -> pcm_s24le (native))
Stream #0:10 -> #0:9 (pcm_s24le (native) -> pcm_s24le (native))
Stream #0:11 -> #0:10 (pcm_s24le (native) -> pcm_s24le (native))
Press [q] to stop, [?] for help
[mpeg2video # 06f8aa40] Automatically choosing VBV buffer size of 746 kbyte
Output #0, mxf, to 'R:\2_SERIES\Eps101_1920x1080_20_51_DV_CC_25fps_20210622_25to23976_works.mxf':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
encoder : Lavf58.30.100
Stream #0:0(eng): Video: mpeg2video (4:2:2) (xd5d / 0x64356478), yuv422p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 50000 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Video Media Handler
timecode : 00:59:59:00
encoder : Lavc58.55.100 mpeg2video
Side data:
cpb: bitrate max/min/avg: 50000000/50000000/50000000 buffer size: 6111232 vbv_delay: 18446744073709551615
Stream #0:1(eng): Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
encoder : Lavc58.55.100 pcm_s24le
Stream #0:2(eng): Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
encoder : Lavc58.55.100 pcm_s24le
Stream #0:3(eng): Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
encoder : Lavc58.55.100 pcm_s24le
Stream #0:4(eng): Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
encoder : Lavc58.55.100 pcm_s24le
Stream #0:5(eng): Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
encoder : Lavc58.55.100 pcm_s24le
Stream #0:6(eng): Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
encoder : Lavc58.55.100 pcm_s24le
Stream #0:7(eng): Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
encoder : Lavc58.55.100 pcm_s24le
Stream #0:8(eng): Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
encoder : Lavc58.55.100 pcm_s24le
Stream #0:9(eng): Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
encoder : Lavc58.55.100 pcm_s24le
Stream #0:10(eng): Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
encoder : Lavc58.55.100 pcm_s24le
frame= 527 fps= 52 q=2.0 Lsize= 166106kB time=00:00:22.00 bitrate=61851.7kbits/s speed=2.19x
video:133971kB audio:30938kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.726204%
This is the output that produces no phasing
C:\Windows>ffmpeg -ss 00:05:13.0 -r 24000/1001 -i "\\bdfs11\array21\Eps101_1920x1080_20_51_DV_CC_25fps_20210622.mov" -t 00:00:22.0 -map 0:v:0 -c:v mpeg2video -profile:v 0 -level:v 2 -b:v 50000k -minrate 50000k -maxrate 50000k -pix_fmt yuv422p -vtag xd5d -force_key_frames "expr:gte(t,n_forced*1)" -streamid 0:481 -streamid 1:129 -filter_complex "[0:a:0][0:a:1][0:a:2][0:a:3][0:a:4][0:a:5][0:a:6][0:a:7][0:a:8][0:a:9] amerge=inputs=10, atempo=24000/25025[FRC]" -map "[FRC]" -c:a pcm_s24le "R:\2_SERIES\Eps101_1920x1080_20_51_DV_CC_25fps_20210622_25to23976_works.mxf" -y
ffmpeg version N-94566-gddd92ba2c6 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.1.1 (GCC) 20190807
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-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-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 33.100 / 56. 33.100
libavcodec 58. 55.100 / 58. 55.100
libavformat 58. 30.100 / 58. 30.100
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 58.100 / 7. 58.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
[mov,mp4,m4a,3gp,3g2,mj2 # 064f5580] Could not find codec parameters for stream 12 (Subtitle: none (c708 / 0x38303763), 1920x1080, 21 kb/s): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Guessed Channel Layout for Input Stream #0.2 : mono
Guessed Channel Layout for Input Stream #0.3 : mono
Guessed Channel Layout for Input Stream #0.4 : mono
Guessed Channel Layout for Input Stream #0.5 : mono
Guessed Channel Layout for Input Stream #0.6 : mono
Guessed Channel Layout for Input Stream #0.7 : mono
Guessed Channel Layout for Input Stream #0.8 : mono
Guessed Channel Layout for Input Stream #0.9 : mono
Guessed Channel Layout for Input Stream #0.10 : mono
Guessed Channel Layout for Input Stream #0.11 : mono
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '\\bdfs11\array21\Eps101_1920x1080_20_51_DV_CC_25fps_20210622.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2021-06-22T17:39:50.000000Z
Duration: 00:59:08.16, start: 0.000000, bitrate: 217983 kb/s
Stream #0:0(eng): Video: prores (HQ) (apch / 0x68637061), yuv422p10le(tv, bt709, progressive), 1920x1080, 206438 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Video Media Handler
encoder : Apple ProRes 422 HQ
timecode : 00:59:59:00
Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
rotate : 0
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Time Code Media Handler
reel_name : untitled
timecode : 00:59:59:00
Stream #0:2(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:3(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:4(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:5(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:6(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:7(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:8(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:9(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:10(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:11(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Sound Media Handler
Stream #0:12(eng): Subtitle: none (c708 / 0x38303763), 1920x1080, 21 kb/s (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Closed Caption Media Handler
Stream mapping:
Stream #0:2 (pcm_s24le) -> amerge:in0 (graph 0)
Stream #0:3 (pcm_s24le) -> amerge:in1 (graph 0)
Stream #0:4 (pcm_s24le) -> amerge:in2 (graph 0)
Stream #0:5 (pcm_s24le) -> amerge:in3 (graph 0)
Stream #0:6 (pcm_s24le) -> amerge:in4 (graph 0)
Stream #0:7 (pcm_s24le) -> amerge:in5 (graph 0)
Stream #0:8 (pcm_s24le) -> amerge:in6 (graph 0)
Stream #0:9 (pcm_s24le) -> amerge:in7 (graph 0)
Stream #0:10 (pcm_s24le) -> amerge:in8 (graph 0)
Stream #0:11 (pcm_s24le) -> amerge:in9 (graph 0)
Stream #0:0 -> #0:0 (prores (native) -> mpeg2video (native))
atempo (graph 0) -> Stream #0:1 (pcm_s24le)
Press [q] to stop, [?] for help
[Parsed_amerge_0 # 06e18dc0] No channel layout for input 1
[Parsed_amerge_0 # 06e18dc0] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
[mpeg2video # 06dea000] Automatically choosing VBV buffer size of 746 kbyte
Output #0, mxf, to 'R:\2_SERIES\Eps101_1920x1080_20_51_DV_CC_25fps_20210622_25to23976_works.mxf':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
encoder : Lavf58.30.100
Stream #0:0(eng): Video: mpeg2video (4:2:2) (xd5d / 0x64356478), yuv422p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 50000 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
Metadata:
creation_time : 2021-06-22T17:39:50.000000Z
handler_name : Apple Video Media Handler
timecode : 00:59:59:00
encoder : Lavc58.55.100 mpeg2video
Side data:
cpb: bitrate max/min/avg: 50000000/50000000/50000000 buffer size: 6111232 vbv_delay: 18446744073709551615
Stream #0:1: Audio: pcm_s24le, 48000 Hz, 10 channels (FL+FR+FC+LFE+BL+BR+FLC+FRC+BC+SL), s32, 11520 kb/s (default)
Metadata:
encoder : Lavc58.55.100 pcm_s24le
frame= 527 fps= 61 q=2.0 Lsize= 165571kB time=00:00:22.00 bitrate=61652.6kbits/s speed=2.56x
video:133971kB audio:30938kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.402084%
Let me know if you need more detail than what I've provided.
EDIT2:
This thread seems like it might hold the solution to my problem:
How do I use ffmpeg to merge all audio streams (in a video file) into one audio channel?
But I don't have enough reputation to respond there in the comments.
When adding the call to ffprobe in a batch file I can't seem to call %~1, %~n1 or %~fn1.
Batch file:
#echo off
SETLOCAL
SET "Container=mov"
:hugly
if "%~1" EQU "" goto mugly
SET "FFREPORT=file=%~n1%~x1.%container%.log:level=32"
ffmpeg -ss 00:10:13.0 -r 24000/1001 -i "%~1" -t 00:00:22.0 ^
-filter_complex "[0:v]scale=w=1920:h=1080:force_original_aspect_ratio=1,pad=1920:1080:(ow-iw)/2:(oh-ih)/2[video];[0:a]amerge=inputs=$(ffprobe -loglevel error -select_streams a -show_entries stream=codec_type -of csv=p=0 "%~1" | wc -l),atempo=24000/24024[audio]" ^
-map [video] -c:v prores_ks ^
-profile:v 3 ^
-vendor apl0 ^
-pix_fmt yuv422p10le ^
-map [audio] -c:a pcm_s24le "G:\%~n1_25to23976_test44.%Container%" -y
shift
goto hugly
:mugly
PAUSE
FFMPEG output:
ffmpeg started on 2021-10-05 at 11:59:00
Report written to "29000_Giant Bear_Film - Candy Hansel [24].mp4.mov.log"
Log level: 32
Command line:
ffmpeg -ss 00:10:13.0 -r 24000/1001 -i "R:\\9_FESTIVALS\\2021\\Blood in the Snow 2021\\Trailers\\Shorts\\29000_Giant Bear_Film - Candy Hansel [24].mp4" -t 00:00:22.0 -filter_complex "[0:v]scale=w=1920:h=1080:force_original_aspect_ratio=1,pad=1920:1080:(ow-iw)/2:(oh-ih)/2[video];[0:a]amerge=inputs=\$(ffprobe -loglevel error -select_streams a -show_entries stream=codec_type -of csv=p=0 R:\\9_FESTIVALS\\2021\\Blood" in the Snow "2021\\Trailers\\Shorts\\29000_Giant" Bear_Film - Candy Hansel "[24].mp4 | wc -l),atempo=24000/24024[audio]" -map "[video]" -c:v prores_ks -profile:v 3 -vendor apl0 -pix_fmt yuv422p10le -map "[audio]" -c:a pcm_s24le "G:\\29000_Giant Bear_Film - Candy Hansel [24]_25to23976_test44.mov" -y
ffmpeg version 2021-09-27-git-b786bc7433-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.3.0 (Rev5, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 57. 7.100 / 57. 7.100
libavcodec 59. 9.101 / 59. 9.101
libavformat 59. 5.100 / 59. 5.100
libavdevice 59. 0.101 / 59. 0.101
libavfilter 8. 9.100 / 8. 9.100
libswscale 6. 1.100 / 6. 1.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'R:\9_FESTIVALS\2021\Blood in the Snow 2021\Trailers\Shorts\29000_Giant Bear_Film - Candy Hansel [24].mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41isomavc1
creation_time : 2019-03-18T17:41:46.000000Z
Duration: 00:12:00.64, start: 0.000000, bitrate: 2310 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x816, 2169 kb/s, 24 fps, 24 tbr, 24 tbn (default)
Metadata:
creation_time : 2019-03-18T17:41:46.000000Z
handler_name : L-SMASH Video Handler
vendor_id : [0][0][0][0]
encoder : AVC Coding
Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 137 kb/s (default)
Metadata:
creation_time : 2019-03-18T17:41:46.000000Z
handler_name : L-SMASH Audio Handler
vendor_id : [0][0][0][0]
[amerge # 0000022701950940] [Eval # 0000005b3f3fe4d0] Undefined constant or missing '(' in 'ffprobe-loglevelerror-select_streamsa-show_entriesstream=codec_type-ofcsv=p=0R'
[amerge # 0000022701950940] Unable to parse option value "$(ffprobe -loglevel error -select_streams a -show_entries stream=codec_type -of csv=p=0 R"
[Parsed_amerge_2 # 0000022701950840] No option name near '9_FESTIVALS2021Blood'
[AVFilterGraph # 000002277ff3f700] Error initializing filter 'amerge' with args 'inputs=$(ffprobe -loglevel error -select_streams a -show_entries stream=codec_type -of csv=p=0 R:9_FESTIVALS2021Blood'
Error initializing complex filters.
Invalid argument
EDIT 3
the following command line outside of a batch file returns the same errors:
ffmpeg -ss 00:10:13.0 -r 24000/1001 -i test.mp4 -t 00:00:22.0 -filter_complex "[0:v]scale=w=1920:h=1080:force_original_aspect_ratio=1,pad=1920:1080:(ow-iw)/2:(oh-ih)/2[video];[0:a]amerge=inputs=$(ffprobe -loglevel error -select_streams a -show_entries stream=codec_type -of csv=p=0 test.mp4 | wc -l),atempo=24000/24024[audio]" -map "[video]" -c:v prores_ks -profile:v 3 -vendor apl0 -pix_fmt yuv422p10le -map "[audio]" -c:a pcm_s24le "G:\%~n1_25to23976_test44.mov" -y
I'm going through the ffprobe commandline entry by entry but I'm uncertain what function the "| wc -l" is performing as the ffprobe manual doesn't have an entry for "wc".
It seems this is a counting function within linux. This is likely why my command is failing!
I am developing an application.
People upload videos from their mobile, from other places.
Using a CMS in PHP (it is the language with which the application is developed) I need to generate a unique video with these partial uploads.
Through FFmpeg I am doing tests, from the command line:
ffmpeg -i concat:IMG_1916.mp4\|IMG_1917.mp4 -c copy videoLoop.mp4
This code when I run it says:
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
[mov,mp4,m4a,3gp,3g2,mj2 # 0x7f8515000000] Found duplicated MOOV Atom. Skipped it Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'concat:IMG_1916.mp4|IMG_1917.mp4':
Metadata:
encoder : Lavf57.66.102
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
Duration: 00:00:04.27, start: 0.000000, bitrate: 26792 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080, 11978 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 120 kb/s (default)
Metadata:
handler_name : SoundHandler
Output #0, mp4, to 'videoLoop.mp4':
Metadata:
compatible_brands: isomiso2avc1mp41
major_brand : isom
minor_version : 512
encoder : Lavf57.56.101
Stream #0:0(und): Video: h264 (Constrained Baseline) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080, q=2-31, 11978 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, mono, 120 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 127 fps=0.0 q=-1.0 Lsize= 6264kB time=00:00:04.22 bitrate=12142.8kbits/s speed= 376x
video:6196kB audio:63kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.076698%
This execution generates a video, but not concatenated with the 2 specified, only with the first one.
Why not join the 2?
The videos to upload, will be of very different formats so I can not define codec.
You will have to make all inputs similar before concatenation, then use the concat filter. A rough example (you will of course have to customize it to your needs):
ffmpeg -i input0 -i input1 -filter_complex \
"[0:v]fps=25,scale=1280:720,format=yuv420p,setsar=1,setpts=PTS-STARTPTS[v0]; \
[1:v]fps=25,scale=1280:720,format=yuv420p,setsar=1,setpts=PTS-STARTPTS[v1]; \
[0:a]aformat=channel_layouts=stereo:sample_rates=44100,asetpts=PTS-STARTPTS[a0]; \
[1:a]aformat=channel_layouts=stereo:sample_rates=44100,asetpts=PTS-STARTPTS[a1]; \
[v0][a0][v1][a1]concat=n=2:v=1:a=1[v][a]" \
-map "[v]" -map "[a]" -c:v libx264 -c:a aac -movflags +faststart output.mp4
Using this adaptation of code, i can generate a video with two sources.
ffmpeg -i IMG_1916.mp4 -i IMG_1917.mp4 \
-filter_complex \
"[0:v:0] [0:a:0] \
[1:v:0] [1:a:0] \
concat=n=2:v=1:a=1 [v] [a]" \
-map "[v]" -map "[a]" videoLoop.mp4
I'm not sure if I can concatenate any video format, from any device of any source / format with this code.
The duration of source video and subtracted wav audio is different , why?
I'm recorgnizing subtitle from audio, and I need to add subtitle back to video. So I want the duration of audio and video the same.
ffmpeg -i http://cdn.live.360.cn/huikan_news/vod-media/_XW_203286B417B7C6466B3B_20160627185953.m3u8 -vn test.wav -y
My CLI:
[zhangpengcheng#mobiledev03v ifly]$ ffprobe http://cdn.live.360.cn/huikan_news/vod-media/_XW_203286B417B7C6466B3B_20160627185953.m3u8 2>&1 | grep Duration
Duration: 00:06:51.99, start: 1.400000, bitrate: 0 kb/s
[zhangpengcheng#mobiledev03v ifly]$ ffmpeg -i http://cdn.live.360.cn/huikan_news/vod-media/_XW_203286B417B7C6466B3B_20160627185953.m3u8 -vn test.wav -y
ffmpeg version 3.1.3 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
configuration: --prefix=./build/ --enable-shared --enable-static --enable-libx264 --enable-avisynth --enable-libass --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libopencv --enable-librtmp --enable-gpl --enable-nonfree
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 47.100 / 6. 47.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, hls,applehttp, from 'http://cdn.live.360.cn/huikan_news/vod-media/_XW_203286B417B7C6466B3B_20160627185953.m3u8':
Duration: 00:06:51.99, start: 1.400000, bitrate: 0 kb/s
Program 0
Metadata:
variant_bitrate : 0
Stream #0:0: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv, smpte170m/bt709/bt709), 668x376, 15 tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, mono, fltp, 65 kb/s
[wav # 0x10182e0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, wav, to 'test.wav':
Metadata:
ISFT : Lavf57.41.100
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
Metadata:
encoder : Lavc57.48.101 pcm_s16le
Stream mapping:
Stream #0:1 -> #0:0 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
size= 31904kB time=00:06:51.84 bitrate= 634.6kbits/s speed= 146x
video:0kB audio:31904kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000239%
[zhangpengcheng#mobiledev03v ifly]$ ffprobe test.wav 2>&1 | grep Duration
Duration: 00:06:10.40, bitrate: 705 kb/s
Looks like there are gaps in the original audio.
Use
ffmpeg -i http://cdn.live.360.cn/huikan_news/vod-media/_XW_203286B417B7C6466B3B_20160627185953.m3u8 -af aresample=async=1 -vn test.wav -y
The audio filter will fill in the gaps.
I have 2 videos: background (mp4) and overlay (mov), overlay has transparent background. I am trying to put video with transparent background as overlay on top of background video. But unfortunately overlay completely cover background video with black background instead of transparency.
I am using following command:
Here is the full output for the command:
ffmpeg -y -i rec_20151027_123445.mp4 -vf "[in]format=rgba[ina];movie=overlay_1920x1080_1.mov[o];[ina][o]overlay=0:0" -vcodec qtrle converted.mov
ffmpeg version 2.6 Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.6_1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-vda
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'rec_20151027_123445.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2015-10-27 10:34:57
location : +50.0474+036.2031/
location-eng : +50.0474+036.2031/
Duration: 00:00:06.04, start: 0.000000, bitrate: 16863 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080, 16837 kb/s, SAR 1:1 DAR 16:9, 29.62 fps, 29.75 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2015-10-27 10:34:57
handler_name : VideoHandle
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 95 kb/s (default)
Metadata:
creation_time : 2015-10-27 10:34:57
handler_name : SoundHandle
[swscaler # 0x7fa3db0ada00] No accelerated colorspace conversion found from yuva420p to argb.
Output #0, mov, to 'converted.mov':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
location-eng : +50.0474+036.2031/
location : +50.0474+036.2031/
encoder : Lavf56.25.101
Stream #0:0(eng): Video: qtrle (rle / 0x20656C72), argb, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 29.75 fps, 15232 tbn, 29.75 tbc (default)
Metadata:
creation_time : 2015-10-27 10:34:57
handler_name : VideoHandle
encoder : Lavc56.26.100 qtrle
Stream #0:1(eng): Audio: aac (libvo_aacenc) (mp4a / 0x6134706D), 48000 Hz, mono, s16, 128 kb/s (default)
Metadata:
creation_time : 2015-10-27 10:34:57
handler_name : SoundHandle
encoder : Lavc56.26.100 libvo_aacenc
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> qtrle (native))
Stream #0:1 -> #0:1 (aac (native) -> aac (libvo_aacenc))
Press [q] to stop, [?] for help
frame= 179 fps= 19 q=0.0 Lsize= 126621kB time=00:00:06.05 bitrate=171213.2kbits/s dup=1 drop=1
video:126519kB audio:95kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.005055%