Opened 14 months ago
Last modified 14 months ago
#11614 new defect
concat demux: video from 2nd file missing in concatenated file
| Reported by: | bzipitidoo | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | ffmpeg |
| Version: | 7.1 | Keywords: | concat demuxer |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Tried to concatenate 3 files by concatenating the 1st 2, which was successful, then with a separate invocation, concatenate the 3rd file to the file resulting from concatenating the 1st 2. ffmpeg did not report any errors, yet this produced a bad file. The combination of all 3 files looked to be the correct size. VLC will play it. But in the combined file, the video from the 3rd file did not appear, only the audio.
The video files are the same video and audio codecs (mpeg4 and libopus), bit rates (400k video, 24k audio), and dimensions (700x700). I used -c copy.
$ ls -s wp*
5468 wp123.mkv 4892 wp12.mkv 576 wp3.mkv
$ cat file_list.txt
file 'wp12.mkv'
file 'wp3.mkv'
$ ffmpeg -f concat -i file_list.txt -c copy wp123.mkv
ffmpeg version 7.1.1 Copyright (c) 2000-2025 the FFmpeg developers
built with gcc 14 (Gentoo 14.2.1_p20241221 p7)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --docdir=/usr/share/doc/ffmpeg-7.1.1-r1/html --ar=x86_64-pc-linux-gnu-ar --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --nm=x86_64-pc-linux-gnu-nm --pkg-config=x86_64-pc-linux-gnu-pkg-config --ranlib=x86_64-pc-linux-gnu-ranlib --disable-stripping --disable-debug --disable-optimizations --optflags=' ' --enable-iconv --enable-pic --enable-shared --disable-static --enable-manpages --disable-podpages --disable-txtpages --disable-decklink --disable-libaribcaption --disable-libdavs2 --disable-libklvanc --disable-liblcevc-dec --disable-libmysofa --disable-libopenvino --disable-libshine --disable-libtls --disable-libuavs3d --disable-libvvenc --disable-libxavs --disable-libxavs2 --disable-libxevd --disable-libxeve --disable-pocketsphinx --disable-rkmpp --disable-vapoursynth --disable-cuda-nvcc --disable-libcelt --disable-libglslang --disable-liblensfun --disable-libmfx --disable-libopencv --disable-librist --disable-libtensorflow --disable-libtorch --disable-mbedtls --disable-mmal --disable-omx --disable-omx-rpi --disable-gcrypt --disable-lzma --enable-libpulse --enable-gpl --disable-ffnvcodec --enable-bzlib --disable-libvpl --disable-opencl --disable-libsrt --enable-libaom --disable-libvpx --disable-libzvbi --disable-libsmbclient --disable-libgsm --disable-libxvid --enable-libvidstab --disable-librav1e --disable-vdpau --disable-libjxl --disable-librabbitmq --disable-libopenh264 --disable-libquirc --disable-libjack --disable-libflite --disable-libsnappy --disable-libtwolame --disable-libsvtav1 --disable-libmp3lame --disable-cuvid --disable-libopenmpt --disable-libplacebo --disable-libfribidi --disable-libfdk-aac --disable-libbs2b --disable-appkit --disable-libspeex --disable-liblc3 --enable-postproc --enable-libxml2 --disable-libshaderc --disable-libzimg --disable-alsa --enable-libfontconfig --enable-libdav1d --disable-libvmaf --disable-sdl2 --disable-nvdec --disable-cuda-llvm --disable-libaribb24 --disable-libnpp --enable-libdrm --disable-libxcb-shm --disable-libkvazaar --enable-gnutls --disable-nvenc --disable-amf --disable-libxcb --disable-libcodec2 --disable-lcms2 --disable-libopencore-amrnb --disable-libtesseract --disable-libvo-amrwbenc --enable-libopus --disable-gmp --enable-vulkan --disable-libdvdread --disable-libopenjpeg --disable-vaapi --disable-libx264 --disable-libx265 --disable-librtmp --enable-libwebp --enable-zlib --disable-libxcb-shape --disable-libsoxr --disable-librubberband --disable-libzmq --disable-htmlpages --disable-libv4l2 --disable-libssh --disable-libtheora --disable-libmodplug --disable-opengl --disable-libdvdnav --enable-libfreetype --disable-openal --disable-librsvg --enable-libass --disable-libgme --disable-chromaprint --disable-ladspa --disable-libiec61883 --disable-libilbc --disable-libcdio --disable-frei0r --disable-sndio --disable-libcaca --disable-libxcb-xfixes --disable-libbluray --disable-libopencore-amrwb --disable-libdc1394 --disable-libqrencode --disable-xlib --disable-openssl --disable-lv2 --disable-libvorbis --enable-libharfbuzz
libavutil 59. 39.100 / 59. 39.100
libavcodec 61. 19.101 / 61. 19.101
libavformat 61. 7.100 / 61. 7.100
libavdevice 61. 3.100 / 61. 3.100
libavfilter 10. 4.100 / 10. 4.100
libswscale 8. 3.100 / 8. 3.100
libswresample 5. 3.100 / 5. 3.100
libpostproc 58. 3.100 / 58. 3.100
Input #0, concat, from 'file_list.txt':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p(tv, progressive), 700x700 [SAR 1:1 DAR 1:1], 30 fps, 30 tbr, 1k tbn
Metadata:
HANDLER_NAME : VideoHandler
VENDOR_ID : [0][0][0][0]
ENCODER : Lavc61.19.101 mpeg4
DURATION : 00:00:35.000000000
Stream #0:1: Audio: opus, 48000 Hz, mono, fltp
Metadata:
HANDLER_NAME : SoundHandler
VENDOR_ID : [0][0][0][0]
DURATION : 00:00:35.096000000
File 'wp123.mkv' already exists. Overwrite? [y/N] y
Stream mapping:
Output #0, matroska, to 'wp123.mkv':
Metadata:
encoder : Lavf61.7.100
Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p(tv, progressive), 700x700 [SAR 1:1 DAR 1:1], q=2-31, 30 fps, 30 tbr, 1k tbn
Metadata:
HANDLER_NAME : VideoHandler
VENDOR_ID : [0][0][0][0]
ENCODER : Lavc61.19.101 mpeg4
DURATION : 00:00:35.000000000
Stream #0:1: Audio: opus ([255][255][255][255] / 0xFFFFFFFF), 48000 Hz, mono, fltp
Metadata:
HANDLER_NAME : SoundHandler
VENDOR_ID : [0][0][0][0]
DURATION : 00:00:35.096000000
Press [q] to stop, ? for help
[out#0/matroska @ 0x55c99ab92980] video:5307KiB audio:132KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.467071%
frame= 1131 fps=0.0 q=-1.0 Lsize= 5464KiB time=00:00:43.31 bitrate=1033.4kbits/s speed=1.94e+03x
$ ffprobe wp12.mkv
...
Input #0, matroska,webm, from 'wp12.mkv':
Metadata:
COMPATIBLE_BRANDS: isomiso2mp41
MAJOR_BRAND : isom
MINOR_VERSION : 512
ENCODER : Lavf61.7.100
Duration: 00:00:35.10, start: -0.007000, bitrate: 1141 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p(tv, progressive), 700x700 [SAR 1:1 DAR 1:1], 30 fps, 30 tbr, 1k tbn (default)
Metadata:
HANDLER_NAME : VideoHandler
VENDOR_ID : [0][0][0][0]
ENCODER : Lavc61.19.101 mpeg4
DURATION : 00:00:35.000000000
Stream #0:1: Audio: opus, 48000 Hz, mono, fltp (default)
Metadata:
HANDLER_NAME : SoundHandler
VENDOR_ID : [0][0][0][0]
DURATION : 00:00:35.096000000
$ ffprobe wp3.mkv
...
Input #0, matroska,webm, from 'wp3.mkv':
Metadata:
COMPATIBLE_BRANDS: isomiso2mp41
MAJOR_BRAND : isom
MINOR_VERSION : 512
ENCODER : Lavf61.7.100
Duration: 00:00:08.30, start: -0.007000, bitrate: 568 kb/s
Stream #0:0(eng): Video: mpeg4 (Simple Profile), yuv420p(tv, bt470bg/bt709/bt709, progressive), 700x700 [SAR 1:1 DAR 1:1], 10 fps, 10 tbr, 1k tbn (default)
Metadata:
HANDLER_NAME : VideoHandler
VENDOR_ID : [0][0][0][0]
ENCODER : Lavc61.19.101 mpeg4
DURATION : 00:00:08.300000000
Stream #0:1(eng): Audio: opus, 48000 Hz, mono, fltp (default)
Metadata:
HANDLER_NAME : SoundHandler
VENDOR_ID : [0][0][0][0]
DURATION : 00:00:08.208000000
$ ffprobe wp123.mkv
...
Input #0, matroska,webm, from 'wp123.mkv':
Metadata:
ENCODER : Lavf61.7.100
Duration: 00:00:43.40, start: 0.000000, bitrate: 1031 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p(tv, progressive), 700x700 [SAR 1:1 DAR 1:1], 30 fps, 30 tbr, 1k tbn
Metadata:
HANDLER_NAME : VideoHandler
VENDOR_ID : [0][0][0][0]
ENCODER : Lavc61.19.101 mpeg4
DURATION : 00:00:43.403000000
Stream #0:1: Audio: opus, 48000 Hz, mono, fltp
Metadata:
HANDLER_NAME : SoundHandler
VENDOR_ID : [0][0][0][0]
DURATION : 00:00:43.324000000
Attachments (3)
Change History (5)
by , 14 months ago
by , 14 months ago
by , 14 months ago
comment:1 by , 14 months ago
Maybe it's an issue with the colorspace? I tried this:
ffmpeg -ss 25 -i wp12.mp4 -c:v mpeg4 -c:a copy -b:v 400k -colorspace 1 -color_primaries 1 -color_trc 1 wp12.mkv
Then I concatenated the files. Didn't work, the video from wp3.mkv still doesn't show up in wp123.mkv.
Next, I tried:
ffmpeg -ss 25 -i wp12.mp4 -c:v mpeg4 -c:a copy -b:v 400k -vf colorspace=all=bt470bg/bt709/bt709:iall=bt601-6-625:fast=1 -colorspace 1 -color_primaries 1 -color_trc 1 wp12.mkv
Still didn't work.
comment:2 by , 14 months ago
Okay, figured it out. Changed colorspace, primaries, trc of file wp12, and the frame rate of file wp3. Once everything matched, then the concat operation produced a file that vlc likes. Why didn't ffmpeg throw an error or at least a warning that the files did not match perfectly? I didn't know there was such a thing as different colorspaces and the rest, until I read up on it.
ffmpeg -i wp12.mp4 -c:v mpeg4 -c:a copy -b:v 400k -vf colorspace=space=bt470bg:trc=bt709:primaries=bt709:iall=bt601-6-625 wp12.mkv
ffmpeg -i wp3.mp4 -c:v mpeg4 -c:a copy -b:v 400k -r 30 wp3.mkv



Shortened wp12.mkv to fit within the 2.5 MB limit.