[Ffmpeg-devel] movenc.c ipod h264 suggested change

Jason Millard jsm174
Tue Mar 28 19:09:01 CEST 2006


Actually here is the correct diff. I had the wrong original file. Sorry.

-- Jason

On 3/28/06, Jason Millard <jsm174 at gmail.com> wrote:
> Okay. Attached is the diff.
>
> On 3/28/06, Oded Shimon <ods15 at ods15.dyndns.org> wrote:
> > On Tue, Mar 28, 2006 at 11:52:23AM -0500, Jason Millard wrote:
> > > Hello.
> > >
> > > I have the following code changes I would like to suggest for
> > > movenc.c. They will allow the correct baseline/profile to be set for
> > > ipod videos. I'm new to this, so I would like to run this by the list:
> > >
> > > $ diff .movenc.c movenc.c
> >
> > Use diff -u, and send the output as an attachement, not inline in mail.
> >
> > - ods15
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at mplayerhq.hu
> > http://mplayerhq.hu/mailman/listinfo/ffmpeg-devel
> >
>
>
>
-------------- next part --------------
--- .movenc.c	Sun Mar 26 08:34:52 2006
+++ movenc.c	Tue Mar 28 11:41:38 2006
@@ -34,6 +34,7 @@
 #define MODE_PSP 3 // example working PSP command line:
 // ffmpeg -i testinput.avi  -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 M4V00001.MP4
 #define MODE_3G2 4
+#define MODE_IPOD 5
 
 typedef struct MOVIentry {
     unsigned int flags, size;
@@ -435,9 +436,19 @@
             end = track->vosData + track->vosLen;
 
             put_byte(pb, 1); /* version */
-            put_byte(pb, 77); /* profile */
+
+            if ( track->mode == MODE_IPOD )
+            {
+               put_byte(pb, 66); /* baseline profile */
+               put_byte(pb, 13); /* level 1.3 */
+            }
+            else
+            {
+               put_byte(pb, 77); /* profile */
+               put_byte(pb, 30); /* level */
+            }
+
             put_byte(pb, 64); /* profile compat */
-            put_byte(pb, 30); /* 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) */
 
@@ -1485,7 +1496,8 @@
         put_tag(pb, "3g2a");
     else if ( mov->mode == MODE_PSP )
         put_tag(pb, "MSNV");
-    else if ( mov->mode == MODE_MP4 )
+    else if ( (mov->mode == MODE_MP4) || 
+              (mov->mode == MODE_IPOD) )
         put_tag(pb, "isom");
     else
         put_tag(pb, "qt  ");
@@ -1498,7 +1510,8 @@
         put_tag(pb, "3g2a");
     else if ( mov->mode == MODE_PSP )
         put_tag(pb, "MSNV");
-    else if ( mov->mode == MODE_MP4 )
+    else if ( (mov->mode == MODE_MP4) ||
+              (mov->mode == MODE_IPOD) )
         put_tag(pb, "mp41");
     else
         put_tag(pb, "qt  ");
@@ -1570,6 +1583,7 @@
         else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3G2;
         else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV;
         else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP;
+        else if (!strcmp("ipod", s->oformat->name)) mov->mode = MODE_IPOD;
 
         mov_write_ftyp_tag(pb,s);
         if ( mov->mode == MODE_PSP ) {
@@ -1820,6 +1834,20 @@
     .flags = AVFMT_GLOBALHEADER,
 };
 
+static AVOutputFormat ipod_oformat = {
+    "ipod",
+    "iPod mp4 format",
+    NULL,
+    "mp4,ipod",
+    sizeof(MOVContext),
+    CODEC_ID_AAC,
+    CODEC_ID_MPEG4,
+    mov_write_header,
+    mov_write_packet,
+    mov_write_trailer,
+    .flags = AVFMT_GLOBALHEADER,
+};
+
 static AVOutputFormat _3g2_oformat = {
     "3g2",
     "3gp2 format",
@@ -1841,5 +1869,6 @@
     av_register_output_format(&mp4_oformat);
     av_register_output_format(&psp_oformat);
     av_register_output_format(&_3g2_oformat);
+    av_register_output_format(&ipod_oformat);
     return 0;
 }



More information about the ffmpeg-devel mailing list