0

I'm using the following libavformat functions to read an audio file (various formats) and then write it to a new file on disk:

  • avformat_open_input (start reading new stream)
  • avio_open (begin new file to write)
  • avformat_write_header (write same header as I started reading)
  • av_read_frame (get frame)
  • av_write_frame (write on frame to disk)

I'm wondering if it's possible to add encryption to this, either just for the header part or for the while file. That is, I want to encrypt the data before it's actually written to the new file and then decrypt before I read it the next time.

Is there any FFMPEG support to encrypt on read and decrypt on write using AES encryption?

If not, is there someway I can intercept and alter the data which is being read or written when using the functions above?

I know that in libavutil there is an AES encrypt/decrypt functions (in aes.h) but I cant find any good information on how to fit it into the other libavformat functions that I'm using.

Thanks

1 Answer 1

0

After a lot of research I couldn't find a built-in way to do this in FFMPEG.

My solution instead was to encrypt and decrypt the file before i used it with FFMPEG.

I did however find a function in libavutil/aes.h which helped my do the actual encryption:

void av_aes_crypt (AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.