On date Monday 2013-12-02 10:36:58 +0800, Krissa Carbon encoded: > Good day. > > I have been trying to implement a video segmenter in objective-c for an > application on iPhone. I see that the ffmpeg has all the things I need such > as encoders when used in a terminal of a pc. > > I have already ported the ffmpeg codes to be used in iOS. I would like to > ask if you can give me tips on how can I trace the encoding and > segmentation process in the ffmpeg code so I can mimic this process in iOS. > > the command I use to encode and segment my file using mac terminal is: > > ffmpeg -i <video-file> -vcodec libx264 -acodec libfaac -r 29.97 -profile:v > baseline -b:v 2048k -maxrate 2048k -minrate 2048k -bufsize 2048k > -force_key_frames 'expr:gte(t,n_forced*1)' -map 0 -flags -global_header -f > segment -segment_list index.m3u8 -segment_time 1 -segment_format mpeg_ts > -segment_list_type m3u8 segment%05d.ts > > or > > ffmpeg -i <video-file> -c copy -bsf h264_mp4toannexb -r 29.97 -profile:v > baseline -b:v 2048k -maxrate 2048k -minrate 2048k -bufsize 2048k > -force_key_frames 'expr:gte(t,n_forced*1)' -map 0 -flags -global_header -f > segment -segment_list index.m3u8 -segment_time 1 -segment_format mpeg_ts > -segment_list_type m3u8 segment%05d.ts
All the segmenter relevant code is in libavformat/segment.c, and it's relatively simple. -force_key_frames is implemented in ffmpeg.c, but you can easily emulate the behavior forcing the key_frame flag in the frame passed to the encoder according to custom application logic. Note that if you are using libavformat, you can directly use the segment muxer. _______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
