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

Thomas Mundt loudmax at yahoo.de
Sun Oct 11 19:52:34 CEST 2015


Hi,almost 2 weeks ago I mailed this patch but no one answered.Maybe I should give more informations about this:When trying to encode AVC-Intra with ffmpeg/x264 in mov container I get following x264 error message "Separate headers not supported in AVC-Intra mode".Also x264_sei_version_write is called with the x264_encoder_headers function, which should be not allowed for AVC-Intra.
I first wrote a patch for ffmpeg to fix this but then I thought that it makes more sense to patch x264 because other applications using x264 may behave the same.Please comment or just give me a short information if there is no interest.
Regards,Thomas
 


     Thomas Mundt <loudmax at yahoo.de> schrieb am 1:49 Dienstag, 29.September 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



_______________________________________________
x264-devel mailing list
x264-devel at videolan.org
https://mailman.videolan.org/listinfo/x264-devel


  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20151011/6bd8e608/attachment.html>


More information about the x264-devel mailing list