Question

I'd like to do several things to a MP4 video, but I am not sure where to start.

Some things I'd like to do:
- Change the color of the video to Black & White, Sepia, etc.
- Add animations, such as fade in, fade out, custom images/text moving around
- Embed text into the video

Essentially, the basic features of a video editing program.

Is there a code library that I can use to do these for a MP4 video? Or somewhere I can read to get started? I can't seem to find any info about this, especially the format of MP4.

I am thinking that I will need to apply some kind of RGB conversion for each frame of the video for the color effects, and possibly append a video of the animations I want to the MP4 video given.

EDIT: Thanks a lot for the info guys. I am trying to do this programmtically BTW. FFmpeg is only for video conversions so that doesn't quite do what I want. Puffadder provided the necessary info for me to understand what to do. Anyhow, thanks a lot everyone!

Was it helpful?

Solution

Shervin,

MP4 is not a video format. It is a container. There is a difference. So when you say "MP4 Video", you are technically incorrect. The container (e.g. MP4, Matroska, AVI, etc.) simply contains several multimedia and/or text streams into a single file and the "format" of the container simply specifies the way in which these streams are stored into your container file and nothing about the "video" inside it. To find out what streams are there in your MP4 file, you need a tool like "mp4box". It will give you information about the multimedia streams and will also allow for extraction of these streams. Consider "yamb" for this purpose.

AFAIK, ffmpeg is an encoding/decoding tool, not a video editor. So i believe its not fit for your job (unless you need to do some video format conversion).

Regarding the format of MP4, it is ISO/IEC 14496-14 specification and NOT freely available. I don't feel you need it either. Just use yamb to extract the video from MP4 file and find a video editing library.

OTHER TIPS

I would recommend FFMPEG too, I have used to it perform motion detection and motion-outlining on real-time mp4 video streams, it takes some thought, but my process was, decompress the frame to raw RGB or YUV data, examine the data with a comparison algorithm, then mark the "moved" pixels with a specific colour (red) using the edge-detection algorithm (optimized for my case). Once you have the raw data which you have processed, you can re-compress it on the fly using FFMPEG. You can even store the data to a file using FFMPEG, or you can stream it over a network using live555. If you do decide to stream the data using live555, then you will be able to connect to the stream (and download it) using vlc, or any other rtsp-capable media player.

ffmpeg is a household name for video conversion including MPEG-4. I don't know whether it has objective-C bindings but I wouldn't be surprised if it has.

Provided you are on the Mac (and not iPhone) and have Core Video and Core Image available I believe you can use Core Image filters for the task.

A good place to start seems to be the Core Video Programming Guide.

You can also use Quartz Composer and setup a pipeline graphically. Then you can load and use it from code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top