rbash88 / pyffmpeg

Automatically exported from code.google.com/p/pyffmpeg
0 stars 0 forks source link

pyffmpeg can't open some H.264 files #23

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Install a recent version of ffmpeg and make sure it can load the file / make 
sure pyffmpeg is built using that version of ffmpeg
2.
        arg1 = <path to the file>
        arg2 = {}
        arg2['video1'] = (0, -1, {} )
        arg2['video1'][2]['dest_height'] = -1
        arg2['video1'][2]['dest_width'] = -1
        arg2['video1'][2]['outputmode'] = pyffmpeg.OUTPUTMODE_NUMPY
        reader.open(arg1 , arg2)

What is the expected output? What do you see instead?

Here's the backtrace:
File "pyffmpeg.pyx", line 1686, in pyffmpeg.FFMpegReader.open (pyffmpeg.c:10777)
  File "pyffmpeg.pyx", line 1738, in pyffmpeg.FFMpegReader.__finalize_open (pyffmpeg.c:11353)
  File "pyffmpeg.pyx", line 1271, in pyffmpeg.VideoTrack.init (pyffmpeg.c:6410)
  File "pyffmpeg.pyx", line 845, in pyffmpeg.Track.init (pyffmpeg.c:2834)
IOError: Unable to get decoder

What version of the product are you using? On what operating system?

happens in both beta and stable. the backtrace i provided is from beta.

Please provide any additional information below.

A file that causes the problem is attached

Original issue reported on code.google.com by goodfell...@gmail.com on 14 Jul 2010 at 8:35

Attachments:

GoogleCodeExporter commented 8 years ago
I am using PyFFMPEG to open  hundred of thousands of video files regularly and 
I generally have no problem. The file you send to me is not supported by my 
version of FFMPEG, are you sure it is supported by your ?

# I have the same behavior 
$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyffmpeg
>>> 
r=pyffmpeg.FFMpegReader();r.open("/home/tranx/Download/actioncliptrain00001.mp4"
)
0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pyffmpeg.pyx", line 1947, in pyffmpeg.FFMpegReader.open (pyffmpeg.c:11983)
  File "pyffmpeg.pyx", line 2047, in pyffmpeg.FFMpegReader.__finalize_open (pyffmpeg.c:12852)
  File "pyffmpeg.pyx", line 1406, in pyffmpeg.VideoTrack.init (pyffmpeg.c:7050)
  File "pyffmpeg.pyx", line 921, in pyffmpeg.Track.init (pyffmpeg.c:2986)
IOError: Unable to get decoder
>>> 

# But it is normal, since  FFMPEG actually don't have a codec for your file 
format
$ ffplay /home/tranx/Downloads/actioncliptrain00001.mp4

FFplay version SVN-r0.5.1-4:0.5.1-1ubuntu1, Copyright (c) 2003-2009 Fabrice 
Bellard, et al.
  configuration: --extra-version=4:0.5.1-1ubuntu1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libavfilter    0. 4. 0 /  0. 4. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on Mar  4 2010 12:41:55, gcc: 4.4.3
/home/tranx/Downloads/actioncliptrain00001.mp4: could not open codecs

Original comment by bertrand...@gmail.com on 15 Jul 2010 at 12:06

GoogleCodeExporter commented 8 years ago
Ah, well this is interesting. I am able to convert the video using:
ffmpeg -i file.mp4 -vcodec mpeg4 output.avi
This was why I thought pyffmpeg should be able to open it. But when I try 
ffplay like you did, I get the same error as you. If you have any ideas about 
why that is, let me know, but for now I guess I will turn to the ffmpeg mailing 
list.

Original comment by goodfell...@gmail.com on 15 Jul 2010 at 1:56

GoogleCodeExporter commented 8 years ago
Actually, it turns out ffplay works too, I was just forgetting to invoke it 
with a full path so the old version was loading the file. Here's what the 
latest version of ffplay does with the file:

FFplay version SVN-r24072, Copyright (c) 2003-2010 the FFmpeg developers
  built on Jul  7 2010 14:31:46 with gcc 4.3.0 20080428 (Red Hat 4.3.0-8)
  configuration: --enable-shared
  libavutil     50.20. 0 / 50.20. 0
  libavcodec    52.79. 1 / 52.79. 1
  libavformat   52.73. 0 / 52.73. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.20. 1 /  1.20. 1
  libswscale     0.11. 0 /  0.11. 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x169d950] max_analyze_duration reached
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 
'/data/lisa5/DARPA/Hollywood2/Clips/actioncliptrain00001.avi':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
  Duration: 00:00:08.00, start: 0.000000, bitrate: 1402 kb/s
    Stream #0.0(eng): Video: [0][0][0][0] / 0x0000, 600 tbr, 600 tbn, 600 tbc
    Stream #0.1(eng): Video: mjpeg, yuvj420p, 300x200 [PAR 72:72 DAR 3:2], 1399 kb/s, 24.99 fps, 25 tbr, 600 tbn, 600 tbc
[ffplay_output @ 0x16bc960] auto-inserting filter 'auto-inserted scaler 0' 
between the filter 'src' and the filter 'out'
[scale @ 0x1687980] w:300 h:200 fmt:yuvj420p -> w:300 h:200 fmt:yuv420p 
flags:0x4
1279551496.26 A-V:  0.000 s:0.0 aq=    0KB vq=   31KB sq=    0B f=0/0   

Original comment by goodfell...@gmail.com on 19 Jul 2010 at 2:58

GoogleCodeExporter commented 8 years ago
Hence, if you have two versions of FFPLAY/FFMPEG on your system it may mean 
that 
your pyffmpeg module is not linked with the "latest" version.

Can you provide me the output of ldd on your latest version FFPLAY and run ldd 
on your pyffmpeg.so file. 

Original comment by bertrand...@gmail.com on 19 Jul 2010 at 3:06

GoogleCodeExporter commented 8 years ago
ldd on pyffmpeg.so:
linux-vdso.so.1 =>  (0x00007fff13550000)
    libavformat.so.52 => /u/goodfeli/ffmpeg/libavformat/libavformat.so.52 (0x00007fe16d99d000)
    libavcodec.so.52 => /u/goodfeli/ffmpeg/libavcodec/libavcodec.so.52 (0x00007fe16cd71000)
    libavutil.so.50 => /u/goodfeli/ffmpeg/libavutil/libavutil.so.50 (0x00007fe16cb5d000)
    libswscale.so.0 => /u/goodfeli/ffmpeg/libswscale/libswscale.so.0 (0x00007fe16c929000)
    libpython2.5.so.1.0 => /usr/lib64/libpython2.5.so.1.0 (0x00007fe16c58b000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fe16c370000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fe16c003000)
    libm.so.6 => /lib64/libm.so.6 (0x00007fe16bd7e000)
    libbz2.so.1 => /lib64/libbz2.so.1 (0x00007fe16bb6e000)
    libz.so.1 => /lib64/libz.so.1 (0x00007fe16b958000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fe16b754000)
    libutil.so.1 => /lib64/libutil.so.1 (0x00007fe16b551000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003787400000)

ldd on latest version of ffplay:
    linux-vdso.so.1 =>  (0x00007fff001ff000)
    libavdevice.so.52 => /u/goodfeli/ffmpeg/libavdevice/libavdevice.so.52 (0x00007f2a708e0000)
    libavfilter.so.1 => /u/goodfeli/ffmpeg/libavfilter/libavfilter.so.1 (0x00007f2a706d2000)
    libavformat.so.52 => /u/goodfeli/ffmpeg/libavformat/libavformat.so.52 (0x00007f2a70405000)
    libavcodec.so.52 => /u/goodfeli/ffmpeg/libavcodec/libavcodec.so.52 (0x00007f2a6f7d8000)
    libswscale.so.0 => /u/goodfeli/ffmpeg/libswscale/libswscale.so.0 (0x00007f2a6f5a5000)
    libavutil.so.50 => /u/goodfeli/ffmpeg/libavutil/libavutil.so.50 (0x00007f2a6f391000)
    libm.so.6 => /lib64/libm.so.6 (0x0000003788a00000)
    libSDL-1.2.so.0 => /usr/lib64/libSDL-1.2.so.0 (0x0000003787c00000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003789200000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003788600000)
    libasound.so.2 => /lib64/libasound.so.2 (0x000000379a200000)
    libbz2.so.1 => /lib64/libbz2.so.1 (0x0000003b0b400000)
    libz.so.1 => /lib64/libz.so.1 (0x0000003789600000)
    libdl.so.2 => /lib64/libdl.so.2 (0x0000003788e00000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003787400000)
    librt.so.1 => /lib64/librt.so.1 (0x000000378b200000)

Original comment by goodfell...@gmail.com on 19 Jul 2010 at 3:31

GoogleCodeExporter commented 8 years ago
The libraries loaded are apparently the same. It may be useful to libavfilter 
and libavdevice to the dependencies of the project in case the codec would 
require a dependency from one these file, to see if it changes something but it 
is very unlikely.

I will try to upgrade my ffmpeg to the latest version, and check if I can read 
your file with my ffplay / try to reproduce the error.

Original comment by bertrand...@gmail.com on 19 Jul 2010 at 3:41

GoogleCodeExporter commented 8 years ago
I had the same problem (in fact I wasn't able to open any file [of the two I 
tested], but ffmpeg cli tools worked fine). Investigation showed, that 
avcodec_find_decoder always returned null. av_register_all got called, so it 
should work!?
I finally saw, that pyffmpeg is linked against libavformat *and* explicitly 
against libavcodec, which is a bad thing, because in the order of linking 
(-lavformat -lavcodec) you suddenly have two different libavcodec in memory and 
the initialized one isn't used...

Removing avcodec from libs in setup.py resolved the issue for me.

Original comment by md...@gmx.de on 27 Jan 2011 at 8:13

GoogleCodeExporter commented 8 years ago
Thanks for this very useful and interesting comment. I will check how many 
issues it solves...

Original comment by bertrand...@gmail.com on 1 Feb 2011 at 3:04

GoogleCodeExporter commented 8 years ago

Original comment by martin.h...@gmail.com on 17 Mar 2011 at 11:46