Opened 9 months ago

Last modified 7 weeks ago

#9577 new defect

Wrong segments encoding to MXF XDCAM HD422

Reported by: Michel Owned by:
Priority: normal Component: ffmpeg
Version: unspecified Keywords: segment mpeg2video
Cc: Michel Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

Hi all,
I'm trying to encode a feed from a Decklink card to MXF XDCAM HD422 by segment.
The command line I use works fine, but the resulting segments are incorrect. Segments after the first segment always have the first three frames duplicated with the third frame. !!!
Also, not always, in the transition from first segment to second segment there is a missing frame. This results in a one-frame delayed audio over the video in the post-first segments.

How to reproduce:

"E:\\Ffmpeg\\bin\\ffmpeg.exe" -f dshow -video_size 1920x1080 -r 25 -pixel_format uyvy422 -rtbufsize 702000k -framerate 25 -i "video=Decklink Video Capture:audio=Decklink Audio Capture" -c:v mpeg2video -b:v 50M -maxrate 50M -minrate 50M -bf 2 -g 12 -r 25 -pix_fmt yuv422p -filter_complex "[0:a]channelsplit=channel_layout=stereo[left][right]" -acodec pcm_s24le -ar 48000 -map 0:0 -map "[left]" -map "[right]" -f mxf -flags +ilme+ildct -top 1 -f segment -segment_time 20 -segment_atclocktime 1 -strftime 1 -reset_timestamps 1 "E:\\Ffmpeg\\bin\\_REC_1\\_SEGMENTS_\\REC_2_SEG__%d-%m-%Y__%Hh%Mm%Ss__XDCAM_422_Field_UP.MXF" -report
ffmpeg version git-2019-12-03-12bbfc4 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.2.1 (GCC) 20191125
  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-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 36.101 / 56. 36.101
  libavcodec     58. 64.101 / 58. 64.101
  libavformat    58. 35.101 / 58. 35.101
  libavdevice    58.  9.101 / 58.  9.101
  libavfilter     7. 67.100 /  7. 67.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, dshow, from 'video=Decklink Video Capture:audio=Decklink Audio Capture':
  Duration: N/A, start: 0.181883, bitrate: 1536 kb/s
    Stream #0:0: Video: rawvideo (HDYC / 0x43594448), uyvy422(tv), 1920x1080, 25 fps, 25 tbr, 10000k tbn, 10000k tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:1 (pcm_s16le) -> channelsplit (graph 0)
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg2video (native))
  channelsplit:FL (graph 0) -> Stream #0:1 (pcm_s24le)
  channelsplit:FR (graph 0) -> Stream #0:2 (pcm_s24le)
Press [q] to stop, [?] for help
[mpeg2video @ 0000027eb282c180] Automatically choosing VBV buffer size of 746 kbyte
[segment @ 0000027eb2829600] Opening 'E:\Ffmpeg\bin\_REC_1\_SEGMENTS_\REC_2_SEG__31-12-2021__16h10m22s__XDCAM_422_Field_UP.MXF' for writing
Output #0, segment, to 'E:\Ffmpeg\bin\_REC_1\_SEGMENTS_\REC_2_SEG__%d-%m-%Y__%Hh%Mm%Ss__XDCAM_422_Field_UP.MXF':
  Metadata:
    encoder         : Lavf58.35.101
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(progressive), 1920x1080, q=2-31, 50000 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.64.101 mpeg2video
    Side data:
      cpb: bitrate max/min/avg: 50000000/50000000/50000000 buffer size: 6111232 vbv_delay: N/A
    Stream #0:1: Audio: pcm_s24le, 48000 Hz, 1 channels (FL), s32, 1152 kb/s
    Metadata:
      encoder         : Lavc58.64.101 pcm_s24le
    Stream #0:2: Audio: pcm_s24le, 48000 Hz, 1 channels (FR), s32, 1152 kb/s
    Metadata:
      encoder         : Lavc58.64.101 pcm_s24le
[mxf @ 0000027ec03990c0] missing frames=00:00:17.24 bitrate=N/A speed=   1x
[segment @ 0000027eb2829600] Opening 'E:\Ffmpeg\bin\_REC_1\_SEGMENTS_\REC_2_SEG__31-12-2021__16h10m40s__XDCAM_422_Field_UP.MXF' for writing
[segment @ 0000027eb2829600] Opening 'E:\Ffmpeg\bin\_REC_1\_SEGMENTS_\REC_2_SEG__31-12-2021__16h11m00s__XDCAM_422_Field_UP.MXF' for writing
[segment @ 0000027eb2829600] Opening 'E:\Ffmpeg\bin\_REC_1\_SEGMENTS_\REC_2_SEG__31-12-2021__16h11m20s__XDCAM_422_Field_UP.MXF' for writing
frame= 1514 fps= 25 q=2.0 Lsize=N/A time=00:01:00.52 bitrate=N/A speed=   1x
video:369442kB audio:17021kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Exiting normally, received signal 2.

Attachments (1)

ffmpeg-20211231-161022.log (1.3 MB ) - added by Michel 9 months ago.
ffmpeg -report

Download all attachments as: .zip

Change History (5)

by Michel, 9 months ago

Attachment: ffmpeg-20211231-161022.log added

ffmpeg -report

comment:1 by Diederick Niehorster, 9 months ago

You ffmpeg is quite old: git-2019-12-03. Can you try with latest master (e.g. the builds from gyan.dev) and see if the issue comes up

in reply to:  1 comment:2 by Michel, 9 months ago

Replying to Diederick Niehorster:

You ffmpeg is quite old: git-2019-12-03. Can you try with latest master (e.g. the builds from gyan.dev) and see if the issue comes up

Hi Diederick,
Thanks for answering. I hope this behavior could be solved in a way...
I will try as you suggest with latest master from gyan.dev and will report the result on Monday.

Happy new year.

comment:3 by Michel, 9 months ago

Hi,
Just tried using latest master from gyan.dev and the result is the same...
Segments after the first segment always have the first three frames duplicated with the third frame. !!!

"E:\\Ffmpeg\\bin\\TEST\\ffmpeg-2021-12-30-git-12f21849e5-full_build\\bin\\ffmpeg.exe" -f dshow -video_size 1920x1080 -r 25 -pixel_format uyvy422 -rtbufsize 702000k -framerate 25 -i "video=Decklink Video Capture:audio=Decklink Audio Capture" -c:v mpeg2video -b:v 50M -maxrate 50M -minrate 50M -bf 2 -g 12 -r 25 -pix_fmt yuv422p -filter_complex "[0:a]channelsplit=channel_layout=stereo[left][right]" -acodec pcm_s24le -ar 48000 -map 0:0 -map "[left]" -map "[right]" -f mxf -flags +ilme+ildct -top 1 -f segment -segment_time 20 -segment_atclocktime 1 -strftime 1 -reset_timestamps 1 "E:\\Ffmpeg\\bin\\_REC_1\\_SEGMENTS_\\REC_2_SEG__%d-%m-%Y__%Hh%Mm%Ss__XDCAM_422_Field_UP.MXF" -report
ffmpeg version 2021-12-30-git-12f21849e5-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.2.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-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --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-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --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-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-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      57. 13.100 / 57. 13.100
  libavcodec     59. 15.102 / 59. 15.102
  libavformat    59. 10.100 / 59. 10.100
  libavdevice    59.  1.100 / 59.  1.100
  libavfilter     8. 21.100 /  8. 21.100
  libswscale      6.  1.102 /  6.  1.102
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, dshow, from 'video=Decklink Video Capture:audio=Decklink Audio Capture':
  Duration: N/A, start: 0.216811, bitrate: 1536 kb/s
  Stream #0:0: Video: rawvideo (HDYC / 0x43594448), uyvy422, 1920x1080, 25 fps, 25 tbr, 10000k tbn
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:1 (pcm_s16le) -> channelsplit:default (graph 0)
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg2video (native))
  channelsplit (graph 0) -> Stream #0:1 (pcm_s24le)
  channelsplit (graph 0) -> Stream #0:2 (pcm_s24le)
Press [q] to stop, [?] for help
[mpeg2video @ 0000012a44a3f3c0] Automatically choosing VBV buffer size of 746 kbyte
[segment @ 0000012a44a3e040] Opening 'E:\Ffmpeg\bin\_REC_1\_SEGMENTS_\REC_2_SEG__03-01-2022__09h06m34s__XDCAM_422_Field_UP.MXF' for writing
Output #0, segment, to 'E:\Ffmpeg\bin\_REC_1\_SEGMENTS_\REC_2_SEG__%d-%m-%Y__%Hh%Mm%Ss__XDCAM_422_Field_UP.MXF':
  Metadata:
    encoder         : Lavf59.10.100
  Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, top first), 1920x1080, q=2-31, 50000 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc59.15.102 mpeg2video
    Side data:
      cpb: bitrate max/min/avg: 50000000/50000000/50000000 buffer size: 6111232 vbv_delay: N/A
  Stream #0:1: Audio: pcm_s24le, 48000 Hz, 1 channels (FL), s32, 1152 kb/s (default)
    Metadata:
      encoder         : Lavc59.15.102 pcm_s24le
  Stream #0:2: Audio: pcm_s24le, 48000 Hz, 1 channels (FR), s32, 1152 kb/s
    Metadata:
      encoder         : Lavc59.15.102 pcm_s24le
[segment @ 0000012a44a3e040] Opening 'E:\Ffmpeg\bin\_REC_1\_SEGMENTS_\REC_2_SEG__03-01-2022__09h06m40s__XDCAM_422_Field_UP.MXF' for writing
[segment @ 0000012a44a3e040] Opening 'E:\Ffmpeg\bin\_REC_1\_SEGMENTS_\REC_2_SEG__03-01-2022__09h07m00s__XDCAM_422_Field_UP.MXF' for writing
frame=  738 fps= 25 q=2.5 Lsize=N/A time=00:00:29.50 bitrate=N/A speed=0.998x
video:179989kB audio:8302kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Exiting normally, received signal 2.

In fact, every version I've used has the same behavior...
Could there be something wrong with the command line I use? a missing parameter? buffer?
note: I use a similar command line but using codec dnxhd, without problems.

"ffmpeg.exe" -f dshow -video_size 1920x1080 -r 25 -pixel_format uyvy422 -rtbufsize 702000k -framerate 25 ^
-i video="Decklink Video Capture":audio="Decklink Audio Capture" ^
-c:v dnxhd -b:v 120M -c:a pcm_s16le ^
-flags +ilme+ildct -top 1 -af aresample ^
-f segment -segment_time 20 -segment_atclocktime 1 -strftime 1 -reset_timestamps 1 ^
"%MyPath%\%MyFileName%__%%d-%%m-%%Y__%%Hh%%Mm%%Ss__DNxHD_120M_Field_UP.MOV"

comment:4 by Michel, 7 weeks ago

Please, could someone give me some hints on this?
Is it possible to get correct segments using XDCAM encoding?

I tried using a file as input instead

ffmpeg.exe -re -i "Senyal-TEST-Barres-TC-Beep-Ch1-400hz-Ch2-1000hz.mxf" ^
-c:v mpeg2video -b:v 50M -maxrate 50M -minrate 50M -bf 2 -g 12 ^
-profile:v 0 -level:v 2 -r 25 -pix_fmt yuv422p ^
-filter_complex "[0:a]channelsplit=channel_layout=stereo[left][right]" ^
-acodec pcm_s24le -ar 48000 -map 0:0 -map "[left]" -map "[right]" -f mxf ^
-flags +ilme+ildct -top 1 ^
-f segment -segment_time 2 -segment_atclocktime 1 -strftime 1 -reset_timestamps 1 ^
"%MyFileName%__%%d-%%m-%%Y__%%Hh%%Mm%%Ss_SEG_XDCAM_422_Field_UP.MXF" -v 32

the behavior is the same...

Any help is very welcome.
Thanks in advance

Last edited 7 weeks ago by Michel (previous) (diff)
Note: See TracTickets for help on using tickets.