rosenbjerg / FFMpegCore

A .NET FFMpeg/FFProbe wrapper for easily integrating media analysis and conversion into your C# applications
MIT License
1.64k stars 296 forks source link

Codec 'mpeg1video' (1) is not supported by the bitstream filter 'h264_mp4toannexb'. Supported codecs are: h264 (27) #457

Open progmech opened 1 year ago

progmech commented 1 year ago

Hello, I'm tried to join several videos using the following code:

foreach (var file in recordFiles)
{
  var fileDuration = GetFileDuration(file);
  if (File.Exists(tempFile))
  {
    FFMpeg.Join(tempFile, file);
  }
  else
  {
    FFMpeg.SubVideo(file, tempFile, TimeSpan.FromSeconds(0), fileDuration);
  }
}

Unfortunatelly, I recieved the error mentioned in the topic when the FFMpeg.Join is executed.

Here is the entire error text:

FFMpegCore.Exceptions.FFMpegException: 'ffmpeg exited with non-zero exit-code (22 - ffmpeg version 2023-06-08-git-024c30aa3b-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers built with gcc 12.2.0 (Rev10, 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-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint libavutil 58. 12.100 / 58. 12.100 libavcodec 60. 17.100 / 60. 17.100 libavformat 60. 6.100 / 60. 6.100 libavdevice 60. 2.100 / 60. 2.100 libavfilter 9. 8.101 / 9. 8.101 libswscale 7. 3.100 / 7. 3.100 libswresample 4. 11.100 / 4. 11.100 libpostproc 57. 2.100 / 57. 2.100 Input #0, mpeg, from 'c:\Temp\VideoIn\STOLFF103\20230614T111227.mpg': Duration: 00:00:32.78, start: 0.533333, bitrate: 3096 kb/s Stream #0:0[0x1e0]: Video: mpeg1video, yuv420p(tv), 2688x1520 [SAR 1:1 DAR 168:95], 104857 kb/s, 30 fps, 60 tbr, 90k tbn [h264_mp4toannexb @ 0000021108093500] Codec 'mpeg1video' (1) is not supported by the bitstream filter 'h264_mp4toannexb'. Supported codecs are: h264 (27) [vost#0:0/copy @ 000002110833d7c0] Error initializing bitstream filter: h264_mp4toannexb Invalid argument)'

and the callstack:

This exception was originally thrown at this call stack: FFMpegCore.FFMpegArgumentProcessor.HandleCompletion(bool, int, System.Collections.Generic.IReadOnlyList) FFMpegCore.FFMpegArgumentProcessor.ProcessSynchronously(bool, FFMpegCore.FFOptions) FFMpegCore.FFMpeg.Convert(string, string, FFMpegCore.Enums.ContainerFormat, FFMpegCore.Enums.Speed, FFMpegCore.Enums.VideoSize, FFMpegCore.Enums.AudioQuality, bool) FFMpegCore.FFMpeg.Join.AnonymousMethod__7_0(string) System.Linq.Enumerable.SelectArrayIterator<TSource, TResult>.ToArray() FFMpegCore.FFMpeg.Join(string, string[]) FulfillmentPackingVideoService.Helpers.VideoProducer.ProcessRecordFiles(FulfillmentPackingVideoService.Models.VideoRecord, System.Collections.Generic.List) in VideoProducer.cs

Files were created using the following command:

ffmpeg -rtsp_transport tcp -use_wallclock_as_timestamps 1 -i rtsp://user:password@192.168.0.1:554 -f segment -reset_timestamps 1 -segment_time 30 -segment_format mpg -segment_atclocktime 1 -strftime 1 C:\Temp\%Y%m%dT%H%M%S.mpg

Would you please research the issue and fix it or provide a workaround?

NguyenThangWorkAccount commented 4 months ago

I'm meeting the same issue here, but mine is with the same mp4 with different video codec.