[Libav-user] Error when decode first frame of h264 video file

Clément Champetier cnt at mikrosimage.eu
Tue Dec 30 18:34:34 CET 2014


Hi all,

I have a problem when I try to decode a specific video file, using a C++
wrapper around FFmpeg library (https://github.com/mikrosimage/avTranscoder).

When I decode the first frame, I get the error:
*[h264 @ 0xc60fa0] no frame!*
*Invalid data found when processing input*

The file is not corrupted because ffplay succeeded to decode the video.
Is there any parameter which is use in the ffmpeg application to manage
h264?
I think the problem is that I am not reading the first frame... Maybe a
part of the header... Any idea ?

------------------------------------------------------------------------
*ffprobe inputFile.mp4*
ffprobe version 1.0 Copyright (c) 2007-2012 the FFmpeg developers
  built on Oct  4 2012 10:40:23 with gcc 4.6 (SUSE Linux)
  configuration: --prefix=/usr --mandir=/usr/share/man --libdir=/usr/lib64
--shlibdir=/usr/lib64 --disable-stripping --enable-pthreads --enable-shared
--enable-avfilter --disable-static --enable-libfaac --enable-libmp3lame
--enable-libxvid --enable-libx264 --enable-nonfree --enable-postproc
--enable-shared --enable-libdc1394 --enable-libtheora
--enable-libschroedinger --enable-libvpx --enable-gpl
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3
--enable-x11grab
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 59.100 / 54. 59.100
  libavformat    54. 29.104 / 54. 29.104
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'inputFile.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf54.29.104
  Duration: 00:04:13.91, start: 0.000000, bitrate: 20284 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
3840x2160 [SAR 1:1 DAR 16:9], 20153 kb/s, 29.97 fps, 29.97 tbr, 90k tbn,
59.94 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo,
s16, 125 kb/s
    Metadata:
      handler_name    : SoundHandler
------------------------------------------------------------------------
*Hexa of the beginning of the file*
0000 0020 6674 7970 6973 6f6d 0000 0200
6973 6f6d 6973 6f32 6176 6331 6d70 3431
0000 0008 6672 6565 0003 fd2a 6d64 6174
0000 02a1 0605 ffff 9ddc 45e9 bde6 d948
b796 2cd8 20d9 23ee ef78 3236 3420 2d20
636f 7265 2031 3235 202d 2048 2e32 3634
2f4d 5045 472d 3420 4156 4320 636f 6465
6320 2d20 436f 7079 6c65 6674 2032 3030
332d 3230 3132 202d 2068 7474 703a 2f2f
7777 772e 7669 6465 6f6c 616e 2e6f 7267
2f78 3236 342e 6874 6d6c 202d 206f 7074
696f 6e73 3a20 6361 6261 633d 3120 7265
663d 3320 6465 626c 6f63 6b3d 313a 303a
3020 616e 616c 7973 653d 3078 333a 3078
3131 3320 6d65 3d68 6578 2073 7562 6d65
3d37 2070 7379 3d31 2070 7379 5f72 643d
312e 3030 3a30 2e30 3020 6d69 7865 645f
7265 663d 3120 6d65 5f72 616e 6765 3d31
3620 6368 726f 6d61 5f6d 653d 3120 7472
656c 6c69 733d 3120 3878 3864 6374 3d31
2063 716d 3d30 2064 6561 647a 6f6e 653d
3231 2c31 3120 6661 7374 5f70 736b 6970
3d31 2063 6872 6f6d 615f 7170 5f6f 6666
7365 743d 2d32 2074 6872 6561 6473 3d31
3220 6c6f 6f6b 6168 6561 645f 7468 7265
6164 733d 3220 736c 6963 6564 5f74 6872
6561 6473 3d30 206e 723d 3020 6465 6369
6d61 7465 3d31 2069 6e74 6572 6c61 6365
643d 3020 626c 7572 6179 5f63 6f6d 7061
743d 3020 636f 6e73 7472 6169 6e65 645f
696e 7472 613d 3020 6266 7261 6d65 733d
3320 625f 7079 7261 6d69 643d 3220 625f
6164 6170 743d 3120 625f 6269 6173 3d30
2064 6972 6563 743d 3120 7765 6967 6874
623d 3120 6f70 656e 5f67 6f70 3d30 2077
6569 6768 7470 3d32 206b 6579 696e 743d
3235 3020 6b65 7969 6e74 5f6d 696e 3d32
3520 7363 656e 6563 7574 3d34 3020 696e
7472 615f 7265 6672 6573 683d 3020 7263
5f6c 6f6f 6b61 6865 6164 3d34 3020 7263
3d63 7266 206d 6274 7265 653d 3120 6372
663d 3233 2e30 2071 636f 6d70 3d30 2e36
3020 7170 6d69 6e3d 3020 7170 6d61 783d
3639 2071 7073 7465 703d 3420 6970 5f72
6174 696f 3d31 2e34 3020 6171 3d31 3a31
2e30 3000 8000 0006 1265 8884 0067 fd24
a004 3c3c 0a6c abfe 7d37 5d6b f148 e085
8c69 4be2 0000 0300 0003 0000 0300 0003
0000 0300 0003 0005 5d6b d528 4627 b6e3
4000 0003 0000 0300 0003 0000 0300 6380
*------------------------------------------------------------------------*
*Code use to decode the frame*
int ret = avcodec_decode_video2( _codec->getAVCodecContext(), _frame,
&got_frame, &packet );
av_free_packet( &packet );

if( ! nextPacketRead && ret == 0 && got_frame == 0 ) // error or end of file
return false;
if( ret < 0 )
{
char err[AV_ERROR_MAX_STRING_SIZE];
av_strerror( ret, err, sizeof(err) );
throw std::runtime_error( "an error occured during video decoding - " +
std::string(err) );
}
------------------------------------------------------------------------

Cheers,

Clément
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20141230/ac2a2ad1/attachment.html>


More information about the Libav-user mailing list