sofian / drone

FLOSS dataflow software for real-time media
GNU General Public License v2.0
3 stars 3 forks source link

No video stream detected in VideoSource #6

Open sofian opened 11 years ago

sofian commented 11 years ago

I got this weird bug today. When trying to play a video file with VideoSource I get a "no video stream" warning from Drone and nothing plays.

The error seems to be coming from the fact that _formatContext->nb_streams = 0 in Gear_VideoSource.cpp (see below). What is weird is that the av_dump_format call at line 125 outputs finely:

opening movie : /home/tats/Documents/workspace/drone-0.3/GOPR1063-h264.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/tats/Documents/workspace/drone-0.3/GOPR1063-h264.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2012-12-04 06:01:59
    encoder         : HandBrake 0.9.8 2012071800
  Duration: 00:00:18.81, start: 0.000000, bitrate: 1508 kb/s
    Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 720x400 [PAR 80:81 DAR 16:9], 1122 kb/s, 29,86 fps, 29,97 tbr, 90k tbn, 180k tbc
    Metadata:
      creation_time   : 2012-12-04 06:01:59
    Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 160 kb/s
    Metadata:
      creation_time   : 2012-12-04 06:01:59
    Stream #0.2(eng): Audio: ac3, 48000 Hz, stereo, s16, 224 kb/s
    Metadata:
      creation_time   : 2012-12-04 06:01:59

Also weird is that it was working before with the exact same code! I tried to rerun the same example using the first version I was able to compile a few weeks back and it worked fine.

I tried the following withough success:

Here's the relevant lines (125-139) in Gear_VideoSource.cpp:

  av_dump_format(_formatContext, 0, filename.c_str(), 0);

  _videoStreamIndex=-1;
  for (int i=0; i<_formatContext->nb_streams; i++)
    if (_formatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
    {
      _videoStreamIndex=i;
      break;
    }

  if (_videoStreamIndex<0)
  {
    std::cout << "no video stream!" << std::endl;
    return false;
  }
sofian commented 11 years ago

I tried to run a simple example from an ffmpeg tutorial (see tutorial01.c). It has more or less the same code and it runs perfectly. I am starting to believe in more of a memory management error (especially since the "release" version seems to crash). It would help if someone else could reproduce the error under Linux.

sofian commented 11 years ago

This is so weird: now I'm trying to run my old exec of drone (which was working about an hour ago and which I made a backup of) and it doesn't work anymore (same problem).

jukea commented 11 years ago

hey,could it have to do with the fact that we're using ffmpeg 0.8 instead of 0.7 (which was the version at the time ?)

On Thu, Dec 27, 2012 at 7:31 PM, sofian notifications@github.com wrote:

This is so weird: now I'm trying to run my old exec of drone (which was working about an hour ago and which I made a backup of) and it doesn't work anymore (same problem).

— Reply to this email directly or view it on GitHubhttps://github.com/sofian/drone/issues/6#issuecomment-11722298.

julien keable, ingénieur projets web | espresso communication & design | 514.286.9696

sofian commented 11 years ago

Sorry, I understand this was confusing: when I talk about "my old exec of drone" I talk about the version I compiled a few weeks ago (see tag 2012-12-14--tats-linux-drone-revival). Anyway, it doesn't work anymore.

I tried again by including in the gears folder only StringSource, VideoSource and VideoOutput to reduce the chances of error due to mem allocation but I still got the same problem.

It might be because of conflicting versions of ffmpeg or related libraries. I noticed that a week ago apt-get update updated some av* libs, might be related to that. I still don't understand why the ffmpeg tutorial example works and not VideoSource, but it might be because they are not referring to the same library versions: the main difference between both is that the drone gear is compiled into a shared library whereas the tutorial example is compiled into an exec file: maybe the shared library and the static one for some av lib differ.