views:

477

answers:

5

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!

A: 

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.

Pekka
A: 

I would have to second the decision to use ffmpeg. I know some friends who have used it (I haven't personally) and have told me its good.

Brendan
A: 

Open the .mp4 file in a video editor. All of these operations are basic editing operations.

wallyk
-1. This is programming site...he wants to do it in code.
amdfan
He didn't say he wanted to program it—he said he wanted to change the video. The most time-saving, efficient, and properly interactive way to do that is with a video editing tool.
wallyk
Thanks wallyk, but I am trying to do it in code. Sorry if that wasn't clear.
Sherwin
A: 

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.

puffadder
I see, this has been most helpful. Thank you.I think I understand the direction to take now. Since I am trying to do this in code, I will probably want to use MP4Box to extract the video stream. However, it seems like the source code is only available through GPAC, which GPAC added its own modifications. (I can't run MP4Box from shell since I want to do this through the iPhone).After retrieving the stream, I still need some kind of video editing library. But seeing how complicated it's going to be before even getting to this point, this project is probably going to be abandoned.
Sherwin
A: 

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.

m5h
This actually is for an iPhone project, so unfortunately Core Video is unavailable :(
Sherwin
Alright, retagged with iphone.
m5h