I am trying to encrypt a media file and then decrypt that media file before streaming it.
So far I am able to encrypt a media file using the ts-csa key with the help of below command line.
vlc -I dummy filanme.mp4 --sout="#transcode{vcodec=h264,width=640,height=480,vb=750960,acodec=mp3,ab=32,channels=2,samplerate=44100}:std{access=file,mux=ts{csa-ck=ABBBBBBBBBBBBBBB},dst=streamEnc.flv}"
And I am trying to decrypt this file using VLM libvlc calls as shown below
Code: Select all
libvlc_instance_t *vlc;
const char *url;
const char *sout = "#transcode{vcodec=h264,acodec=aac,ab=128,channels=2," \
"samplerate=44100}:http{dst=:8090/testbc.flv}";
const char *media_name = "Foo";
url = argv[1];
char const *options[] = {
"-I dummy", // Don't use any interface
"--ts-csa-ck=ABBBBBBBBBBBBBBB",
};
int numOptions = sizeof(options)/sizeof(options[0]);
printf("Number of Options: %d\n",numOptions);
vlc = libvlc_new(numOptions, options);
libvlc_vlm_add_broadcast(vlc, media_name, url, sout, 0, NULL, true, false);
libvlc_vlm_play_media(vlc, media_name);
$ ./a.out streamEnc.flvNumber of Options: 2
[0x9e0e64c] [Media: Foo] main access out: creating httpd
[0x9e23cd4] [Media: Foo] ts demux error: MPEG-4 descriptor not found
[0x9e24414] [Media: Foo] packetizer_mpeg4audio decoder: AAC channels: 2 samplerate: 44100x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
x264 [info]: profile High, level 3.0
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
x264 [info]: profile High, level 3.1
[0x9e0f964] [Media: Foo] main mux error: cannot add a new stream (unsupported while muxing to this format). You can try increasing sout-mux-caching value
[0x9e146dc] [Media: Foo] stream_out_transcode stream out error: cannot add this stream
My qustion is whether we can decrypt the encrypted media file using VLM API's.?
If yes, what is the the way to do it.
If my steps are correct, where am I making a mistake.?
If not how I can decrypt the media in c code.
Thanks for giving time to read and understand my problem.
Rakesh