Opened 3 years ago

Last modified 3 years ago

#2319 open defect

mencoder crashes while attempting multithreaded encode via lavc codecs

Reported by: AndrewR Owned by: beastd
Priority: normal Component: mencoder
Version: HEAD Severity: major
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: yes Analyzed by developer: no


Summary of the bug:
How to reproduce:

% mencoder pond.dv -o pond-reencoded-3.dv -ovc lavc -lavcopts vcodec=dvvideo:format=411p:threads=2 -oac pcm

version: MEncoder SVN-r37930-4.9.2

Attachments (1)

valgrind.log (19.8 KB) - added by AndrewR 3 years ago.
valgrind -v log

Download all attachments as: .zip

Change History (4)

Changed 3 years ago by AndrewR

valgrind -v log

comment:1 Changed 3 years ago by AndrewR

File pond.dv can be downloaded from

Resulted re-encoded file is not playable in mplayer. If I use threads=1 for encoding - it works ok. Attempt at using another vcodec (mjpeg) also resulted in crash and corrupted file. mplayer/mencoder both use internal ffmpeg (commit ac24a8202a6fdfb469af1fa68d537fb2f8d1ba6a - libavformat/mov: Fix memory leak, need to free the chapter tracks array)

comment:2 Changed 3 years ago by beastd

  • Reproduced by developer set
  • Status changed from new to open

I think I could reproduce the crash.

Will look into it as time permits.

comment:3 Changed 3 years ago by beastd

After a long delay I came back to investigate this problem more.

It turns out this is a problem since FFmpeg commit beb9447 . That commit enabled frame threading for dvvideo. That lead to your encode using both slice and frame threading, which triggered the bug you reported here.

A simple workaround to make it work like before is to tell the FFmpeg dvvideo encoder to use slice threading only:

mencoder pond.dv -o pond-reencoded-3.dv -ovc lavc -lavcopts vcodec=dvvideo:format=411p:threads=2:o=thread_type=-frame -oac pcm
Note: See TracTickets for help on using tickets.