Page MenuHome

VSE can't import OGG Theora video
Closed, ResolvedPublic

Description

System Information
Error reproduced on :

  • Windows 7
  • Linux Debian Stretch
  • Linux Debian Testing

Blender Version
Broken: 2.79 and 2.79b
Worked: 2.78

Short description of error
VSE can not import a OGG Theora video file.

Exact steps for others to reproduce the error

  1. Open Blender
  2. Select the "Video editing" layout.
  3. Click the Add Movie menu
  4. Select a OGG Theora video file
  5. Click the "Add movie Strip" button
  6. You get the error "File XXX could not be loaded" :

Note : the OGG Theora file was generated by Blender itself, and it can be import with Blender 2.78.

Event Timeline

Philipp Oeser (lichtwerk) triaged this task as Confirmed, Medium priority.

Can confirm on first sight.

I can successfully import OGG Theora (from e.g. here), but not blenders own encoded ogv.

Seems to be a framerate issue. Following the read code it will use stream->avg_frame_rate (which comes out 0/0 -- bad) and not stream->r_frame_rate (which is 1/24 in my case -- good)
Later on that will fail when checking anim->duration here

So even when it was encoded with a new version of LibAV, r_frame_rate seems more reliable than avg_frame_rate...

ffmpeg reports framerate correctly (using tbr, too not fps)

Input #0, ogg, from '/Blender Bugtracker/T54834/from_renderings_test.ogv':
  Duration: 00:00:02.08, start: 0.000000, bitrate: 44 kb/s
    Stream #0:0: Video: theora, yuv420p, 640x360 [SAR 1:1 DAR 16:9], 24 tbr, 24 tbn, 24 tbc
    Metadata:
      ENCODER         : Lavf57.56.100

This is probably an easy one for @Sergey Sharybin (sergey), but I'll have a look at the write-code as well and see if I can spot something...

more findings:

  • avg_frame_rate seems to be set correctly when writing (happens here)
  • works OK, if you use Theora, but put it in an avi container (reports fps/avg_frame_rate then, too, can be imported without problems):
Input #0, avi, from '/Blender Bugtracker/T54834/from_renderings_test.avi':
  Metadata:
    encoder         : Lavf57.56.100
  Duration: 00:00:02.08, start: 0.000000, bitrate: 86 kb/s
    Stream #0:0: Video: theora (theo / 0x6F656874), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 24 tbn, 24 tbc

convenience test scene:

I'm afraid @Sergey Sharybin (sergey) has to take over (hitting my 'per-report-time-limit'...)

Hello Philipp,

Thank you for your response.
For your information, video files produced by the recordmydesktop utility have the same issue.

The problem seems to be in the IMB_anim_absolute function (anim_movie.c).

The following line returns NULL :

if (position >= anim->duration) return(NULL);

The value of the variable "position" is 0.
The value of the variable "anim->duration" is -2147483648 !

It seems to be an overflow of the duration which is an int.

The value of the anim->duration variable is calculated in the startffmpeg function (anim_movie.c) :

		anim->duration = (int)(pFormatCtx->duration *
		                       av_q2d(frame_rate) /
		                       AV_TIME_BASE + 0.5f);

With the small theora video which can be loaded succesfully , the value is positive : anim->duration=166
With the theora video file which can't be loaded, the value is negative : anim->duration=-2147483648