[vlc-devel] Encrypting x264 data...

Kaarlo Räihä kaarlo.raiha at gmail.com
Tue Aug 23 09:49:59 CEST 2011


2011/8/23 Peter Tap <ptrtap at yahoo.com>

> Hi Kaarlo,
>
> Thank you once again for your help. Now vlc model has started to become
> clear. A module would typically add "Open" and "Close" static methods within
> vlc_module_begin() and vlc_module_end() pair. In the "Open" method itself,
> the module can specify additional functions such as Mux, AddStream,
> DelStream, etc. Wish there was some documentation on this.
>
> There is one thing that is still confusing. As I now plan to encrypt the
> whole file, I guess I have no choice but to implement my own container.
> Glancing through the source files, it appears containers implement "demux"
> mechanism and not "mux". Hence they are all under "demux" directory. Your
> suggestion is that I need to look into "mux" directory. I am guessing muxing
> comes "after" decoding. I may not get a chance to decrypt before decoding
> happens. Am I missing something?
>

Muxers output video, audio and other data to container. So that avi.c file I
linked earlier is used to write data to .avi files. When you read it, you
use demuxer, in this case
http://git.videolan.org/?p=vlc.git;a=blob;f=modules/demux/avi/avi.c

Chain is following:
Raw video data fed to encoder produces video stream
Raw audio data fed to encoder produces audio stream

video stream + audio stream fed to muxer produces .xyz file (well not actual
files in all cases, like with network streaming)

.xyz file fed to demuxer produces video stream + audio stream
video stream fed to decoder produces raw video stream
audio stream fed to decoder produces raw video stream


> Appreciate your help.
>
> Regards,
> Peter
>
> ------------------------------
> *From:* Kaarlo Räihä <kaarlo.raiha at gmail.com>
> *To:* Mailing list for VLC media player developers <vlc-devel at videolan.org
> >
> *Sent:* Monday, August 22, 2011 10:18 PM
>
> *Subject:* Re: [vlc-devel] Encrypting x264 data...
>
> 2011/8/23 Peter Tap <ptrtap at yahoo.com>
>
> Kaarlo,
>
> Thank you very much for your help. I looked at "demux" directory and mp4 as
> well as mkv examples. However, the use of API is not clear. I would imagine
> the APIs should be:
> 1. Can you handle "xyz" extension?
>
>
> If you mean file extensions, they are generally a bad way to detect stuff,
> but if you are only planning limited distribution it is OK.
>
>
> 2. Give me the type of streams (audio, video, etc.) along with the format
> type (AAC, x264, etc.)
> 3. Give me the next x bytes from nth stream.
>
> On the developer corner, I couldn't find any documentation on how to write
> a muxer. Other than vlc_open and vlc_close, what other methods need to be
> implemented?
>
>
> You can reuse some existing muxer/demux and just encode/decode before/after
> file writing/reading. You have to implement mux, control etc. parts, if you
> want to create completely new muxer see
> http://git.videolan.org/?p=vlc.git;a=blob;f=modules/mux/avi.c and lines
> 164-168
>
>
>
> Appreciate your help.
>
> Regards,
> Peter
>
> ------------------------------
> *From:* Kaarlo Räihä <kaarlo.raiha at gmail.com>
>
> *To:* Mailing list for VLC media player developers <vlc-devel at videolan.org
> >
> *Sent:* Sunday, August 21, 2011 11:26 PM
>
> *Subject:* Re: [vlc-devel] Encrypting x264 data...
>
> 2011/8/22 Peter Tap <ptrtap at yahoo.com>
>
> Folks,
>
> For the project I am working on, I need to create a new container format,
> encrypt x264 data and store it. This file can only be played through vlc and
> I need to provide on-the-fly decryption.
>
>
> I have downloaded and built vlc code. I have also gone through various
> documentation pages. However, I am still confused on where to start. I would
> appreciate it if someone can help me with the following questions:
>
> 1. How to write a new container module?
>
>
> If you are only interested about VLC, you have to create new demux and mux
> modules.
>
>
> 2. I need to use x264 module internally. I need to integrate with it such
> that each block that x264 decodes needs to be decrypted first and passed on
> to x264 decoder. I am wondering what would be a good way to achieve this?
> 3. Although I have built vlc source and vlc seems to run correctly, I am a
> bit confused about where the source files for each module really is. For
> example, when I look under contrib/src/x264, I don't see any .h or .c files.
> I need to debug and step through x264 code. How can I achieve this? Note
> that during the initial ".configure" step, I did specify enable-debug as a
> flag.
>
> Also, may be there is a simpler way of what I am trying to achieve. Perhaps
> I can just hook into x264 decoding mechanism. Is this possible?
>
>
> Do encryption stuff on muxer level. There really isn't any point to change
> x264 and H.264 decoders. With muxer level encryption you can also protect
> the audio tracks and subtitles.
>
>
>
> Thank you in advance for your help.
>
> Regards,
> Peter
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110823/233580b3/attachment.html>


More information about the vlc-devel mailing list