[x264-devel] [PATCH] Fix ffmpeg AVC-Intra encoding with libx264 in mov container

Thomas Mundt loudmax at yahoo.de
Tue Sep 29 02:48:57 CEST 2015


IME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

For x264 encoding in mov container ffmpeg sets x264 parameter b_repeat_headers to 0 and calls x264_encoder_headers which calls x264_sei_version_write function. Both is not allowed for AVC-Intra. Since other applications may behave similar it´s better to avoid this here.

Signed-off-by: Thomas Mundt <loudmax at yahoo.de>
---
 encoder/encoder.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/encoder/encoder.c b/encoder/encoder.c
index 79997b9..e2f0048 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -743,8 +743,8 @@ static int x264_validate_parameters( x264_t *h, int b_open )
 
         if( !h->param.b_repeat_headers )
         {
-            x264_log( h, X264_LOG_ERROR, "Separate headers not supported in AVC-Intra mode\n" );
-            return -1;
+            x264_log( h, X264_LOG_INFO, "Separate headers is not supported in AVC-Intra mode and will be ignored\n" );
+            h->param.b_repeat_headers = 1;
         }
 
         int i;
@@ -2005,12 +2005,14 @@ int x264_encoder_headers( x264_t *h, x264_nal_t **pp_nal, int *pi_nal )
     if( x264_nal_end( h ) )
         return -1;
 
-    /* identify ourselves */
-    x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
-    if( x264_sei_version_write( h, &h->out.bs ) )
-        return -1;
-    if( x264_nal_end( h ) )
-        return -1;
+    /* identify ourselves when not AVC-Intra */
+    if( !h->param.i_avcintra_class ) {
+        x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+        if( x264_sei_version_write( h, &h->out.bs ) )
+            return -1;
+        if( x264_nal_end( h ) )
+            return -1;
+    }
 
     frame_size = x264_encoder_encapsulate_nals( h, 0 );
     if( frame_size < 0 )
-- 
1.9.2




More information about the x264-devel mailing list