[FFmpeg-user] Issue encrypting udp stream using crypto protocol

Julien Ayrault julien.ayrault at letsee.tv
Mon Jan 8 13:48:35 EET 2024


Hi there,

I'm trying to encrpyt  a mutilicast UDP stream with crypto protocol (AES), here is the command line I use:

ffmpeg -f decklink -channels 2 -format_code Hi50 -draw_bars false -video_input sdi -audio_input embedded -i "DeckLink Quad (4)" -filter_complex "[0:v]setfield=mode=tff,setpts=PTS-STARTPTS,drawtext=x=(main_w-text_w)/2:y=(main_h-text_h)/8:fontfile=C\\:/Windows/fonts/consola.ttf:text='TEST-05':box=1:boxcolor=000000CC:boxborderw=20:fontcolor=yellow:fontsize=48[vout];[0:a]asetpts=PTS-STARTPTS[aout]" -c:v libx264 -flags:v +ildct+ilme -g 25 -profile:v high -level:v 41 -tune:v zerolatency -preset:v veryfast -x264-params "nal_hrd=cbr:interlaced=1:weightp=0" -pix_fmt yuv420p -b:v 10000k -minrate:v 6000k -maxrate:v 10000k -bufsize:v 1000k -c:a libfdk_aac -b:a 256k -ar 48000 -metadata service_provider="service provider" -metadata service_name="service name" -map "[vout]" -map "[aout]" -f mpegts -encryption_key 000102030405060708090A0B0C0D0E0F -encryption_iv 000102030405060708090A0B0C0D0E0F "crypto+udp://239.0.0.5:5000?ttl=1&pkt_size=1316&buffer_size=4096000&localaddr=10.40.2.183" -loglevel verbose

The command line above works flawlessly without the crypto protocol.

I've got an error saying "Crypto: seek not supported for write", I don't know why cause I'm even not trying to seek ...
I did a lot of searches on Google, StackOverflow and ffmpeg trac to find a solution but without success till now.
I also tried with different versions of ffmpeg, still same error.

Is anybody already tried to do this ?
Is this a bug ? Should I create a ticket on trac ?

Here is the full console output (verbose):

ffmpeg version n6.1.1-4-gfe3b2419a7-g0f824d792d+85 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.2.0 (Rev3, Built by MSYS2 project)
  configuration:  --pkg-config=pkgconf --cc='ccache gcc' --cxx='ccache g++' --ld='ccache g++' --extra-cxxflags=-fpermissive --extra-cflags=-Wno-int-conversion --disable-autodetect --enable-amf --enable-bzlib --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-iconv --enable-lzma --enable-nvenc --enable-zlib --enable-sdl2 --enable-ffnvcodec --enable-nvdec --enable-cuda-llvm --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libdav1d --enable-libaom --disable-debug --enable-libfdk-aac --enable-fontconfig --enable-libass --enable-libfreetype --enable-libharfbuzz --enable-libfontconfig --enable-libmfx --enable-libmysofa --enable-libopenjpeg --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libshine --enable-gpl --enable-avisynth --enable-libopenmpt --enable-version3 --enable-librav1e --enable-libsrt --enable-libgsm --enable-libvmaf --enable-libsvtav1 --enable-chromaprint --enable-decklink --enable-frei0r --enable-libaribb24 --enable-libcaca --enable-libflite --enable-libfribidi --enable-libilbc --enable-libsvthevc --enable-libsvtvp9 --enable-libkvazaar --enable-librist --enable-librtmp --enable-librubberband --enable-libtesseract --enable-libzmq --enable-openal --enable-libcodec2 --enable-libglslang --enable-vulkan --enable-opengl --enable-libopenh264 --enable-openssl --extra-cflags=-DLIBTWOLAME_STATIC --extra-libs=-lstdc++ --extra-cflags=-DCACA_STATIC --extra-cflags=-DCHROMAPRINT_NODLL --extra-libs=-lstdc++ --extra-cflags=-DZMQ_STATIC --extra-libs=-lpsapi --extra-cflags=-DLIBXML_STATIC --extra-libs=-liconv --disable-w32threads --extra-cflags=-DKVZ_STATIC_LIB --enable-nonfree --extra-cflags=-DAL_LIBTYPE_STATIC --extra-cflags='-IC:/m-ab-s/local64/include' --extra-cflags='-IC:/m-ab-s/local64/include/AL'
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
[decklink @ 0000013cc9656740] Found Decklink mode 1920 x 1080 with rate 25.00(i)
[decklink @ 0000013cc9656740] Using 2 input audio channels
[decklink @ 0000013cc9656740] Frame received (#1) - No input signal detected - Frames dropped 1
[aist#0:0/pcm_s16le @ 0000013cc965c100] Guessed Channel Layout: stereo
Input #0, decklink, from 'DeckLink Quad (4)':
  Duration: N/A, start: 0.000000, bitrate: 830976 kb/s
  Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
  Stream #0:1: Video: rawvideo, 1 reference frame (UYVY / 0x59565955), uyvy422(top first), 1920x1080, 829440 kb/s, 25 tbr, 1000k tbn
[out#0/mpegts @ 0000013cc965adc0] Adding streams from explicit maps...
[out#0/mpegts @ 0000013cc965adc0] Creating output stream from an explicitly mapped complex filtergraph 0, output [vout]
[vost#0:0/libx264 @ 0000013cc9667340] Created video stream from complex filtergraph 0:[drawtext:default]
[vost#0:0/libx264 @ 0000013cc9667340]
[out#0/mpegts @ 0000013cc965adc0] Creating output stream from an explicitly mapped complex filtergraph 0, output [aout]
[aost#0:1/libfdk_aac @ 0000013cc966bcc0] Created audio stream from complex filtergraph 0:[asetpts:default]
[aost#0:1/libfdk_aac @ 0000013cc966bcc0]
Stream mapping:
  Stream #0:0 (pcm_s16le) -> asetpts:default
  Stream #0:1 (rawvideo) -> setfield:default
  drawtext:default -> Stream #0:0 (libx264)
  asetpts:default -> Stream #0:1 (libfdk_aac)
Press [q] to stop, [?] for help
[graph 0 input from stream 0:1 @ 0000013cc96952c0] w:1920 h:1080 pixfmt:uyvy422 tb:1/1000000 fr:25000/1000 sar:0/1
[graph_0_in_0_0 @ 0000013cc9695ec0] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:stereo
[auto_scale_0 @ 0000013cc96961c0] w:iw h:ih flags:'' interl:0
[Parsed_drawtext_2 @ 0000013cc9694cc0] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_setpts_1' and the filter 'Parsed_drawtext_2'
[Parsed_setfield_0 @ 0000013cc96950c0] TB:0.000001 FRAME_RATE:25.000000 SAMPLE_RATE:nan
[auto_scale_0 @ 0000013cc96961c0] w:1920 h:1080 fmt:uyvy422 sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0x00000004
[graph_0_in_0_0 @ 0000013cc9695ec0] TB:0.000021 FRAME_RATE:nan SAMPLE_RATE:48000.000000
[libx264 @ 0000013cc966a7c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000013cc966a7c0] profile High, level 4.1, 4:2:0, 8-bit
[mpegts @ 0000013cc9663940] service 1 using PCR in pid=256, pcr_period=80ms
[mpegts @ 0000013cc9663940] muxrate VBR, sdt every 500 ms, pat/pmt every 100 ms
Output #0, mpegts, to 'crypto+udp://239.0.0.5:5000?ttl=1&pkt_size=1316&buffer_size=4096000&localaddr=10.40.2.183':
  Metadata:
    service_provider: service provider
    service_name    : service name
    encoder         : Lavf60.16.100
  Stream #0:0: Video: h264, 1 reference frame, yuv420p(tv, top coded first (swapped)), 1920x1080 (0x0), q=2-31, 10000 kb/s, 25 fps, 90k tbn
    Metadata:
      encoder         : Lavc60.31.102 libx264
    Side data:
      cpb: bitrate max/min/avg: 10000000/0/10000000 buffer size: 1000000 vbv_delay: N/A
  Stream #0:1: Audio: aac, 48000 Hz, stereo, s16, delay 2048, 256 kb/s
    Metadata:
      encoder         : Lavc60.31.102 libfdk_aac
[crypto @ 0000013cc966c940] Crypto: seek not supported for write

    Last message repeated 1 times
frame=    1 fps=0.0 q=16.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x
[crypto @ 0000013cc966c940] Crypto: seek not supported for write

    Last message repeated 7 times
[aost#0:1/libfdk_aac @ 0000013cc966bcc0] Error submitting a packet to the muxer: I/O error
[out#0/mpegts @ 0000013cc965adc0] Error muxing a packet
[out#0/mpegts @ 0000013cc965adc0] Terminating muxer thread
No more output streams to write to, finishing.
[aist#0:0/pcm_s16le @ 0000013cc965c100] Decoder thread received EOF packet
[aist#0:0/pcm_s16le @ 0000013cc965c100] Decoder returned EOF, finishing
[aist#0:0/pcm_s16le @ 0000013cc965c100] Terminating decoder thread
[vist#0:1/rawvideo @ 0000013cc965e900] Decoder thread received EOF packet
[vist#0:1/rawvideo @ 0000013cc965e900] Decoder returned EOF, finishing
[vist#0:1/rawvideo @ 0000013cc965e900] Terminating decoder thread
[out#0/mpegts @ 0000013cc965adc0] Error writing trailer: I/O error
[crypto @ 0000013cc966c940] Crypto: seek not supported for write

    Last message repeated 1 times
[AVIOContext @ 0000013cc96899c0] Statistics: 0 bytes written, 0 seeks, 2 writeouts
[out#0/mpegts @ 0000013cc965adc0] Error closing file: I/O error
[out#0/mpegts @ 0000013cc965adc0] Output file #0 (crypto+udp://239.0.0.5:5000?ttl=1&pkt_size=1316&buffer_size=4096000&localaddr=10.40.2.183):
[out#0/mpegts @ 0000013cc965adc0]   Output stream #0:0 (video): 3 frames encoded; 2 packets muxed (87500 bytes);
[out#0/mpegts @ 0000013cc965adc0]   Output stream #0:1 (audio): 6 frames encoded (5306 samples); 3 packets muxed (2048 bytes);
[out#0/mpegts @ 0000013cc965adc0]   Total: 5 packets (89548 bytes) muxed
[out#0/mpegts @ 0000013cc965adc0] video:85kB audio:2kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
frame=    2 fps=0.0 q=3.0 Lsize=      40kB time=00:00:00.10 bitrate=3087.9kbits/s speed= 2.8x
[libx264 @ 0000013cc966a7c0] frame I:1     Avg QP: 1.06  size: 37500
[libx264 @ 0000013cc966a7c0] frame P:2     Avg QP: 0.53  size: 50000
[libx264 @ 0000013cc966a7c0] mb I  I16..4: 99.5%  0.0%  0.5%
[libx264 @ 0000013cc966a7c0] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.2%  0.0%  0.0%  0.0%  0.0%    skip:99.7%
[libx264 @ 0000013cc966a7c0] field mbs: intra: 0.0% inter:0.0% skip:0.0%
[libx264 @ 0000013cc966a7c0] 8x8 transform intra:0.0% inter:2.2%
[libx264 @ 0000013cc966a7c0] coded y,uvDC,uvAC intra: 0.3% 0.3% 0.3% inter: 0.2% 0.3% 0.3%
[libx264 @ 0000013cc966a7c0] i16 v,h,dc,p: 75%  0% 25%  0%
[libx264 @ 0000013cc966a7c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 19% 54%  3%  2%  3%  2%  3%  1%
[libx264 @ 0000013cc966a7c0] i8c dc,h,v,p: 100%  0%  0%  0%
[libx264 @ 0000013cc966a7c0] kb/s:9166.67
[in#0/decklink @ 0000013cc96564c0] Terminating demuxer thread
[in#0/decklink @ 0000013cc96564c0] Input file #0 (DeckLink Quad (4)):
[in#0/decklink @ 0000013cc96564c0]   Input stream #0:0 (audio): 3 packets read (21224 bytes); 3 frames decoded; 0 decode errors (5306 samples);
[in#0/decklink @ 0000013cc96564c0]   Input stream #0:1 (video): 4 packets read (16588800 bytes); 3 frames decoded; 0 decode errors;
[in#0/decklink @ 0000013cc96564c0]   Total: 7 packets (16610024 bytes) demuxed
Conversion failed!

Many thanks !
Julien



More information about the ffmpeg-user mailing list