Page MenuHomePhabricator

Transcodes of Ogg Theora videos don't respect picture crop (libav/ffmpeg upstream?)
Open, LowPublic


Theora source videos may have an encoded frame size that is different from the represented picture size; when transcoding, the transcode should keep the same picture area, regardless of what the encoded frame size was.

Example: this funny-sized video is encoded with a non-null picture crop size and position, and the area outside the picture is encoded as solid green thus stressing this bug and making it very visible.



Expected behavior:

  • Transcode should have picture or black bars up to the edge at all times

Actual behavior:

  • Transcode has several pixels of green bar around the picture

This is possibly a bug/feature/misfeature of libav/ffmpeg/ffmpeg2theora...?

Event Timeline

brion created this task.Jul 22 2015, 9:25 AM
brion raised the priority of this task from to Needs Triage.
brion updated the task description. (Show Details)
brion added a subscriber: brion.
Restricted Application added a project: Multimedia. · View Herald TranscriptJul 22 2015, 9:25 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Jdforrester-WMF triaged this task as Low priority.Sep 4 2015, 6:55 PM
Restricted Application added a subscriber: Matanya. · View Herald TranscriptSep 4 2015, 6:55 PM
Jdforrester-WMF moved this task from Untriaged to Backlog on the Multimedia board.Sep 4 2015, 6:59 PM
TheDJ moved this task from To sort to Transcoding on the TimedMediaHandler board.Oct 21 2015, 7:14 PM
TheDJ added a subscriber: TheDJ.EditedMay 2 2016, 11:20 AM

The video in question specifies a visible picture frame (basically a crop command) in the theora header packet. VLC parses this and makes sure that the output frame is adapted.

if( p_sys->ti.pic_width && p_sys->ti.pic_height )
    p_dec-> = p_sys->ti.pic_width;
    p_dec-> = p_sys->ti.pic_height;

    if( p_sys->ti.pic_x || p_sys->ti.pic_y )
        p_dec-> = p_sys->ti.pic_x;
        p_dec-> = p_sys->ti.pic_y;

The definition for this is in the th_info block

It seems that we do not forward such information to ffmpeg, or that ffmpeg does not support this for VP8?

brion added a comment.Aug 3 2018, 11:51 PM

ffmpeg's behavior seems to have updated a bit; it's not perfect but may be "good enough".

The sample file got renamed to and the newer transcodes generated in 2017 have better but still incomplete cropping:

It looks like it's using the right pic_y, or close to it, but not the right pic_x so it's still got a big green bar on the left.

Will check again after re-encoding with the latest goodies.

brion added a comment.Aug 4 2018, 12:08 AM

Yep, same cropping with the new VP9 transcodes (ffmpeg 3.2 I think)