[Ffmpeg-devel] movenc.c ipod h264 suggested change
Jason Millard
jsm174
Wed Mar 29 06:26:13 CEST 2006
Okay attached are changes to ffmpeg.c and movenc.c based upon Michael
and Loren's comments.
I must say I'm puzzled, because I'm confused on how to get profile and
level over the way you wanted.
So I made the code match the other options.
I'm just not sure when AVCodecContext gets filled with information,
ie. say I went
-target ipod -profile 51 -level 30
or
-profile 51 -level 30 -target ipod
I'm not sure if my implementation squashes -profile and -level args.
Thanks,
-- Jason
-------------- next part --------------
--- .ffmpeg.c Tue Mar 28 22:05:10 2006
+++ ffmpeg.c Tue Mar 28 23:12:37 2006
@@ -113,6 +113,8 @@
static int video_mb_lmin = 2*FF_QP2LAMBDA;
static int video_mb_lmax = 31*FF_QP2LAMBDA;
static int video_qdiff = 3;
+static int video_profile = FF_PROFILE_UNKNOWN;
+static int video_level = FF_LEVEL_UNKNOWN;
static float video_qblur = 0.5;
static float video_qsquish = 0.0;
static float video_qcomp = 0.5;
@@ -3221,6 +3223,9 @@
video_enc->frame_skip_factor= frame_skip_factor;
video_enc->frame_skip_exp= frame_skip_exp;
+ video_enc->level = video_level;
+ video_enc->profile = video_profile;
+
if(packet_size){
video_enc->rtp_mode= 1;
video_enc->rtp_payload_size= packet_size;
@@ -3952,6 +3957,22 @@
audio_sample_rate = 48000;
audio_channels = 2;
+ } else if (!strcmp(arg, "ipod")) {
+
+ opt_video_codec("h264");
+ opt_audio_codec("aac");
+
+ opt_frame_size("320x240");
+
+ audio_bit_rate = 128000;
+ audio_sample_rate = 44100;
+ audio_channels = 2;
+
+ video_bit_rate = 500000;
+
+ video_profile = 66;
+ video_level = 13;
+
} else {
fprintf(stderr, "Unknown target: %s\n", arg);
exit(1);
@@ -4020,7 +4041,7 @@
{ "loop_input", OPT_BOOL | OPT_EXPERT, {(void*)&loop_input}, "loop (current only works with images)" },
{ "loop_output", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&loop_output}, "number of times to loop output in formats that support looping (0 loops forever)", "" },
{ "v", HAS_ARG, {(void*)opt_verbose}, "control amount of logging", "verbose" },
- { "target", HAS_ARG, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" },
+ { "target", HAS_ARG, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"pal-vcd\", \"ntsc-svcd\", \"ipod\", ...)", "type" },
{ "threads", HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
{ "vsync", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_sync_method}, "video sync method", "" },
{ "async", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&audio_sync_method}, "audio sync method", "" },
-------------- next part --------------
--- .movenc.c Tue Mar 28 22:29:04 2006
+++ movenc.c Tue Mar 28 22:17:44 2006
@@ -435,9 +435,29 @@
end = track->vosData + track->vosLen;
put_byte(pb, 1); /* version */
- put_byte(pb, 77); /* profile */
+
+ if ( track->enc->profile == FF_PROFILE_UNKNOWN )
+ {
+ put_byte(pb, 77); /* default profile */
+ }
+ else
+ {
+ put_byte(pb, track->enc->profile); /* custom profile */
+
+ }
+
put_byte(pb, 64); /* profile compat */
- put_byte(pb, 30); /* level */
+
+ if ( track->enc->level == FF_LEVEL_UNKNOWN )
+ {
+ put_byte(pb, 30); /* default level */
+ }
+ else
+ {
+ put_byte(pb, track->enc->level); /* custom level */
+
+ }
+
put_byte(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */
put_byte(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */
More information about the ffmpeg-devel
mailing list