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