How to play two videos side by side using FFmpeg? - shell

Hello I want to create a duet video feature like tiktok. I am using FFmpeg. I have tried this code
ffmpeg \
-i movie_output.mp4 \
-i movie_output.mp4 \
-filter_complex \
"nullsrc=size=360x480[base];
[0:v] setpts=PTS-STARTPTS, scale=360x480, crop=180:480:90:0[left];
[1:v] setpts=PTS-STARTPTS, scale=360x480, crop=180:480:90:0 [right];
[base][left] overlay=x=0:y=0[base1];
[base1][right] overlay=shortest=1:x=180:y=0" \
-c:v libx264 \
-y result.mp4
It gives me this error:
No such filter: ' '
Error initializing complex filters.
Invalid argument
Whole output
ubuntu#ip-171-xx-xx-xxx: ffmpeg -i movie_output.mp4 -i movie_output.mp4 -filter_complex "nullsrc=size=360x480[base]; \ [0:v] setpts=PTS-STARTPTS, scale=360x480, crop=180:480:90:0[left]; \ [1:v] setpts=PTS-STARTPTS, scale=360x480, crop=180:480:90:0 [right]; \ [base][left] overlay=x=0:y=0[base1]; \ [base1][right] overlay=shortest=1:x=180:y=0" -c:v libx264 -y result.mp4
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
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
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'movie_output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.45.100
comment : vid:v090440c0000brppph37mt2vmmsj1dig
Duration: 00:00:08.04, start: 0.000000, bitrate: 1135 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 540x960 [SAR 1:1 DAR 9:16], 996 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 129 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'movie_output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.45.100
comment : vid:v090440c0000brppph37mt2vmmsj1dig
Duration: 00:00:08.04, start: 0.000000, bitrate: 1135 kb/s
Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 540x960 [SAR 1:1 DAR 9:16], 996 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 129 kb/s (default)
Metadata:
handler_name : SoundHandler
[AVFilterGraph # 0x560fd395e2e0] No such filter: ' '
Error initializing complex filters.
Invalid argument
I have tried this as well
ffmpeg \
-report \
-i "movie_output.mp4" \
-i "movie_output.mp4" \
-an \
-filter_complex \
"[0:v]trim=start=0:end=9,setpts=PTS-STARTPTS[firstclip];
[1:v]trim=start=1,setpts=PTS-STARTPTS[secondclip];
[0:v]trim=start=9:end=10,setpts=PTS-STARTPTS[fadeoutsrc];
[1:v]trim=start=0:end=1,setpts=PTS-STARTPTS[fadeinsrc];
[fadeinsrc]format=pix_fmts=yuva420p,fade=t=in:st=0:d=1:alpha=1[fadein];
[fadeoutsrc]format=pix_fmts=yuva420p,fade=t=out:st=0:d=1:alpha=1[fadeout];
[fadein]fifo[fadeinfifo];
[fadeout]fifo[fadeoutfifo];
[fadeoutfifo][fadeinfifo]overlay[crossfade];
[firstclip][crossfade][secondclip]concat=n=3" \
outputname.mp4
Output:
ffmpeg started on 2020-06-27 at 10:11:41
Report written to "ffmpeg-20200627-101141.log"
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
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
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'movie_output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.45.100
comment : vid:v090440c0000brppph37mt2vmmsj1dig
Duration: 00:00:08.04, start: 0.000000, bitrate: 1135 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 540x960 [SAR 1:1 DAR 9:16], 996 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 129 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'movie_output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.45.100
comment : vid:v090440c0000brppph37mt2vmmsj1dig
Duration: 00:00:08.04, start: 0.000000, bitrate: 1135 kb/s
Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 540x960 [SAR 1:1 DAR 9:16], 996 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 129 kb/s (default)
Metadata:
handler_name : SoundHandler
[NULL # 0x562dea344220] Unable to find a suitable output format for ' -filter_complex'
-filter_complex: Invalid argument
This code gives this error
Unable to find a suitable output format for ' -filter_complex'
-filter_complex: Invalid argument
Anyone can help?

Related

ffmpeg: "stream specifier '' in filtergraph description matches no streams" during concatenation audio and video

I'm trying to concatenate video and audio files, filling space between them with black frames or silence correspondingly.
I use the following command:
ffmpeg -i test/v/1.mkv -i test/v/2.mkv -i test/v/1.mka -i test/v/2.mka -filter_complex 'color=c=black:s=640x480:d=12ms[black0];
color=c=black:s=640x480:d=207725ms[black2];
aevalsrc=0:d=257495ms[silence1];
aevalsrc=0:d=114833ms[silence2];
[black0][0][black2][1][2][silence1][3][silence2]concat=n=8:v=1:a=1[v_out][a_out]' \
-map [v_out] -map [a_out] -c:v libvpx -c:a libopus result.webm
But I get the following error:
Stream specifier '' in filtergraph description matches no streams.
Full ffmpeg output:
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.17)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_9 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, matroska,webm, from 'test/v/1.mkv':
Metadata:
encoder : GStreamer matroskamux version 1.8.1.1
creation_time : 2021-02-05T16:54:38.000000Z
Duration: 00:00:52.24, start: 0.637000, bitrate: 1922 kb/s
Stream #0:0(eng): Video: vp8, yuv420p(progressive), 640x480, SAR 1:1 DAR 4:3, 29.83 tbr, 1k tbn, 1k tbc (default)
Metadata:
title : Video
Input #1, matroska,webm, from 'test/v/2.mkv':
Metadata:
encoder : GStreamer matroskamux version 1.8.1.1
creation_time : 2021-02-05T16:58:58.000000Z
Duration: 00:02:07.19, start: 260.603000, bitrate: 1966 kb/s
Stream #1:0(eng): Video: vp8, yuv420p(progressive), 640x480, SAR 1:1 DAR 4:3, 29.83 tbr, 1k tbn, 1k tbc (default)
Metadata:
title : Video
Input #2, matroska,webm, from 'test/v/1.mka':
Metadata:
encoder : GStreamer matroskamux version 1.8.1.1
creation_time : 2021-02-05T16:55:58.000000Z
Duration: 00:00:02.44, start: 0.624000, bitrate: 80 kb/s
Stream #2:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Metadata:
title : Audio
Input #3, matroska,webm, from 'test/v/2.mka':
Metadata:
encoder : GStreamer matroskamux version 1.8.1.1
creation_time : 2021-02-05T16:59:01.000000Z
Duration: 00:00:12.40, start: 260.561000, bitrate: 43 kb/s
Stream #3:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Metadata:
title : Audio
Stream specifier '' in filtergraph description color=c=black:s=640x480:d=12ms[black0];
color=c=black:s=640x480:d=207725ms[black2];
aevalsrc=0:d=257495ms[silence1];
aevalsrc=0:d=114833ms[silence3];
[black0][0][black2][1][2][silence1][3][silence3]concat=n=8:v=1:a=1[v_out][a_out] matches no streams.
Video files do not contain audio.
What I'm doing wrong? Help please.

ffmpeg Invalid stream specifier: si

I am trying to run the following command :
-i "2020_11_30_03_37_37.mp4" -i "2020_11_30_03_37_44.jpg" -f lavfi -t 6.016 -i anullsrc -filter_complex "[0:v]crop=544:544:0:208,boxblur=luma_radius=10:chroma_radius=10:luma_power=1,scale=1080:1080[bg];[0:v]scale=612:1080[fg];[bg][fg]overlay=234:0:shortest=1[si];[si]trim=0:1,setpts=(PTS-STARTPTS)*2[video0];[0:a]atrim=0:1,asetpts=PTS-STARTPTS,atempo=0.5[audio0];[si]trim=1:5.016,setpts=(PTS-STARTPTS)*1[video1];[0:a]atrim=1:5.016,asetpts=PTS-STARTPTS,atempo=1[audio1];[video0][audio0][video1][audio1]concat=n=2:v=1:a=1[mv];[1:v]scale=428:-1[sticker1];[mv][sticker1]overlay=x=0:y=0:enable='between(t,0,1)'" "2020_11_30_03_37_50.mp4"
but FFmpeg throwing the following error:
Invalid stream specifier: si.
but I already specified this stream in command. unable to understand what's wrong
here is the log
C:\Users\abhis\AppData\Local\Packages\64815ZMobileApps.VideoDownloaderforYouTubeDownload_61cxy7b35vdsg\TempState>ffmpeg -i "2020_11_30_03_37_37.mp4" -i "2020_11_30_03_37_44.jpg" -f lavfi -t 6.016 -i anullsrc -filter_complex "[0:v]crop=544:544:0:208,boxblur=luma_radius=10:chroma_radius=10:luma_power=1,scale=1080:1080[bg];[0:v]scale=612:1080[fg];[bg][fg]overlay=234:0:shortest=1[si];[si]trim=0:1,setpts=(PTS-STARTPTS)*2[video0];[0:a]atrim=0:1,asetpts=PTS-STARTPTS,atempo=0.5[audio0];[si]trim=1:5.016,setpts=(PTS-STARTPTS)*1[video1];[0:a]atrim=1:5.016,asetpts=PTS-STARTPTS,atempo=1[audio1];[video0][audio0][video1][audio1]concat=n=2:v=1:a=1[mv];[1:v]scale=428:-1[sticker1];[mv][sticker1]overlay=x=0:y=0:enable='between(t,0,1)'" "2020_11_30_03_37_50.mp4"
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 10.2.1 (GCC) 20200726
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 --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. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2020_11_30_03_37_37.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.45.100
Duration: 00:00:05.02, start: 0.000000, bitrate: 2097 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 544x960, 1997 kb/s, SAR 1:1 DAR 17:30, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
handler_name : VideoHandle
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
Metadata:
handler_name : SoundHandle
Input #1, image2, from '2020_11_30_03_37_44.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 2416762 kb/s
Stream #1:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1280x854 [SAR 200:200 DAR 640:427], 25 tbr, 25 tbn, 25 tbc
Input #2, lavfi, from 'anullsrc':
Duration: N/A, start: 0.000000, bitrate: 705 kb/s
Stream #2:0: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s
[mov,mp4,m4a,3gp,3g2,mj2 # 00000279fa82eb80] Invalid stream specifier: si.
Last message repeated 1 times
Stream specifier 'si' in filtergraph description [0:v]crop=544:544:0:208,boxblur=luma_radius=10:chroma_radius=10:luma_power=1,scale=1080:1080[bg];[0:v]scale=612:1080[fg];[bg][fg]overlay=234:0:shortest=1[si];[si]trim=0:1,setpts=(PTS-STARTPTS)*2[video0];[0:a]atrim=0:1,asetpts=PTS-STARTPTS,atempo=0.5[audio0];[si]trim=1:5.016,setpts=(PTS-STARTPTS)*1[video1];[0:a]atrim=1:5.016,asetpts=PTS-STARTPTS,atempo=1[audio1];[video0][audio0][video1][audio1]concat=n=2:v=1:a=1[mv];[1:v]scale=428:-1[sticker1];[mv][sticker1]overlay=x=0:y=0:enable='between(t,0,1)' matches no streams.
You can't re-use labels (a.k.a. "pads", unintuitively) from filter outputs. So you can't use si more than once.
Add the split filter to make copies:
-i "2020_11_30_03_37_37.mp4" -i "2020_11_30_03_37_44.jpg" -f lavfi -t 6.016 -i anullsrc -filter_complex "[0:v]crop=544:544:0:208,boxblur=luma_radius=10:chroma_radius=10:luma_power=1,scale=1080:1080[bg];[0:v]scale=612:1080[fg];[bg][fg]overlay=234:0:shortest=1,split=outputs=2[si1][si2];[si1]trim=0:1,setpts=(PTS-STARTPTS)*2[video0];[0:a]atrim=0:1,asetpts=PTS-STARTPTS,atempo=0.5[audio0];[si2]trim=1:5.016,setpts=(PTS-STARTPTS)*1[video1];[0:a]atrim=1:5.016,asetpts=PTS-STARTPTS,atempo=1[audio1];[video0][audio0][video1][audio1]concat=n=2:v=1:a=1[mv];[1:v]scale=428:-1[sticker1];[mv][sticker1]overlay=x=0:y=0:enable='between(t,0,1)'" "2020_11_30_03_37_50.mp4"

FFMPEG - cut video result in longer cut

I'm trying to cut the last 8 seconds of a video I got; the problem is that ffmpeg is picking the last 10 seconds instead and I don't really know why. I checked and there is no offset between "0:00:00" and the effective start of the video, so why should it take more seconds?
this is my code:
ffmpeg.exe -ss 00:01:02 -i "F:\temp\input.mp4" -c copy -t 00:00:08 "D:\temp\1_output.mp4"
this is the output:
ffmpeg version N-90893-gcae6f806a6 Copyright (c) 2000-2018 the FFmpeg
developers built with gcc 7.3.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-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 libavutil 56. 17.100 / 56. 17.100 libavcodec 58. 19.100 / 58. 19.100 libavformat 58. 13.100 / 58. 13.100 libavdevice 58. 4.100 /
4.100 libavfilter 7. 21.100 / 7. 21.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100 Input #0,
mov,mp4,m4a,3gp,3g2,mj2, from 'F:\temp\input.mp4': Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.13.100 Duration: 00:01:10.34, start: 0.000000, bitrate: 14542 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 576x1024, 14346 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 193 kb/s (default)
Metadata:
handler_name : SoundHandler Output #0, mp4, to 'D:\temp\1_output.mp4': Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.13.100
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 576x1024, q=2-31, 14346 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc
(default)
Metadata:
handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 193 kb/s (default)
Metadata:
handler_name : SoundHandler Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help frame= 252
fps=0.0 q=-1.0 Lsize= 3089kB time=00:00:07.99 bitrate=3164.7kbits/s
speed=1e+003x video:2841kB audio:240kB subtitle:0kB other
streams:0kB global headers:0kB muxing overhead: 0.283155%
I don't really understand what i'm doing wrong
Thanks
do not use "-c copy" it sucks up everything.
just try like this and you are good to go...
ffmpeg.exe -i "F:\temp\input.mp4" -ss 00:01:02 -to 00:01:10 "D:\temp\1_output.mp4"

ffmpeg not generating palettes

I downloaded ffmpeg and ran the command found in the documentation to generate palettes:
ffmpeg -i input.mkv -vf palettegen palette.png
The only difference being my input was input.mp4 instead of input.mkv.
No file gets generated. Here's the console output from PowerShell:
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, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp41isom
creation_time : 2018-11-23T23:27:38.000000Z
Duration: 00:00:09.98, start: 0.000000, bitrate: 2784 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 580x328 [SAR 1:1 DAR 145:82], 2699 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc (default)
Metadata:
creation_time : 2018-11-23T23:27:38.000000Z
handler_name : VideoHandler
encoder : AVC Coding
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 79 kb/s (default)
Metadata:
creation_time : 2018-11-23T23:27:38.000000Z
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> png (native))
Press [q] to stop, [?] for help
Output #0, image2, to 'palette.png':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp41isom
encoder : Lavf57.83.100
Stream #0:0(und): Video: png, rgba, 16x16 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default)
Metadata:
creation_time : 2018-11-23T23:27:38.000000Z
handler_name : VideoHandler
encoder : Lavc57.107.100 png
[Parsed_palettegen_0 # 00000296510def00] 255(+1) colors generated out of 285516 colors; ratio=0.000893
[Parsed_palettegen_0 # 00000296510def00] Dupped color: FF000001
Any ideas?
So I figured out that I had two versions of ffmpeg installed and the first one inside of Path was quite outdated. So I removed the older one and it worked just fine.

How to use ffmpeg to copy streams and preserve format and metadata?

I have two files with multiple streams in each.
Output.mp4 has 2 streams: video and audio (streams 0,1)
Input.mp4 has 3 streams: video, audio and data (streams 0,1,2)
I need to add stream 2 from Input.mp4 to Output.mp4 yielding Final.mov.
I tried using this command but it does seem to preserve the format and metadata for the stream that is added:
ffmpeg -y -i Output.mp4 -i Input.mp4 -c copy -map 0:0 -map 0:1 -map 1:2 Final.mov
The output from ffmpeg seems to show that it is working but the format and metadata for the streams in the Final.mov is not correct.
I would appreciate any help with how to change the command to make it work.
Thank you!
Here is the command output:
ffmpeg -y -i Output.mp4 -i Input.mp4 -c copy -map 0:0 -map 0:1 -map 1:2 Final.mov
ffmpeg version N-84679-gd65b595 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 51.100 / 55. 51.100
libavcodec 57. 86.103 / 57. 86.103
libavformat 57. 67.100 / 57. 67.100
libavdevice 57. 3.101 / 57. 3.101
libavfilter 6. 78.100 / 6. 78.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Output.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
creation_time : 2018-04-15T21:57:13.000000Z
Duration: 00:24:25.05, start: 0.000000, bitrate: 3571 kb/s
Stream #0:0(eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 7680x3840 [SAR 1:1 DAR 2:1], 3252 kb/s, 1 fps, 1 tbr, 100k tbn, 2.15 tbc (default)
Metadata:
creation_time : 2018-04-15T21:57:13.000000Z
handler_name : Alias Data Handler
encoder : HEVC Coding
Side data:
stereo3d: 2D
spherical: equirectangular (0.000000/0.000000/0.000000)
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
Metadata:
creation_time : 2018-04-15T21:57:13.000000Z
handler_name : Alias Data Handler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'Input.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
creation_time : 2018-04-12T12:02:32.000000Z
make : Insta360
model : Insta360 Pro
encoder : Lavf57.71.100
description : {"info":{"gyro_stabilized":false,"initial_view_changed":false}}
Duration: 00:24:25.00, start: -0.004233, bitrate: 6394 kb/s
Stream #1:0(und): Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv), 7680x3840, 6196 kb/s, 1 fps, 1 tbr, 360k tbn, 5 tbc (default)
Metadata:
creation_time : 2018-04-12T12:02:32.000000Z
handler_name : VideoHandler
Side data:
stereo3d: 2D
spherical: equirectangular (0.000000/0.000000/0.000000)
Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 4.0, fltp, 129 kb/s (default)
Metadata:
creation_time : 2018-04-12T12:02:32.000000Z
handler_name : SoundHandler
Stream #1:2(und): Data: none (camm / 0x6D6D6163), 36 kb/s
Metadata:
creation_time : 2018-04-12T12:02:32.000000Z
handler_name : CameraMetadataMotionHandler
Output #0, mov, to 'Final.mov':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
encoder : Lavf57.67.100
Stream #0:0(eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 7680x3840 [SAR 1:1 DAR 2:1], q=2-31, 3252 kb/s, 1 fps, 1 tbr, 100k tbn, 100k tbc (default)
Metadata:
creation_time : 2018-04-15T21:57:13.000000Z
handler_name : Alias Data Handler
encoder : HEVC Coding
Side data:
stereo3d: 2D
spherical: equirectangular (0.000000/0.000000/0.000000)
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
Metadata:
creation_time : 2018-04-15T21:57:13.000000Z
handler_name : Alias Data Handler
Stream #0:2(und): Data: none (camm / 0x6D6D6163), 36 kb/s
Metadata:
creation_time : 2018-04-12T12:02:32.000000Z
handler_name : CameraMetadataMotionHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #1:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
[mov # 0000000004894f00] Unknown hldr_type for camm / 0x6D6D6163, writing dummy valuesd= 629x
frame= 1465 fps=625 q=-1.0 Lsize= 650825kB time=00:24:24.98 bitrate=3639.3kbits/s speed= 625x
video:581593kB audio:56757kB subtitle:0kB other streams:6602kB global headers:0kB muxing overhead: 0.910633%
Here are the streams in the Final.mp4 file:
ffmpeg -i Final.mov
ffmpeg version N-84679-gd65b595 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 51.100 / 55. 51.100
libavcodec 57. 86.103 / 57. 86.103
libavformat 57. 67.100 / 57. 67.100
libavdevice 57. 3.101 / 57. 3.101
libavfilter 6. 78.100 / 6. 78.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
[mov,mp4,m4a,3gp,3g2,mj2 # 0000000002726860] overread end of atom 'stsd' by 2974416 bytes
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Final.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf57.67.100
Duration: 00:24:25.00, start: 0.000000, bitrate: 3639 kb/s
Stream #0:0(eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 7680x3840 [SAR 1:1 DAR 2:1], 3252 kb/s, 1 fps, 1 tbr, 100k tbn, 2.15 tbc (default)
Metadata:
handler_name : DataHandler
encoder : HEVC Coding
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
Metadata:
handler_name : DataHandler
Stream #0:2(eng): Data: none (stts / 0x73747473), 36 kb/s
Metadata:
handler_name : DataHandler

Resources