[vlc-devel] [PATCH v3 0/3] Bug when converting with both deinterlace checked and codec options given

Jérôme Froissart software at froissart.eu
Mon Oct 28 22:15:46 CET 2019

(this v3 of this patchset contains updates and code reviews: SoutMrl now is SoutChain, commit tiles have been changed, etc.)

When converting a video, a sout chain (previously called a sout MRL) is poorly handled.
When the user checks the "deinterlace" option in the GUI, convert.cpp inserts ",deinterlace" into the chain without properly checking for braces. This causes issues in case the passed chain already contains closing braces (which is the case when the selected profile has custom video codec options).

A quick-and-dirty fix would be to be sure to remove only the latest brace of the chain before inserting the "deinterlace" statement, but, well...that would be quick-and-dirty.
I rather send you a more object-oriented implementation of SoutChain, that replaces the former SoutMrl, and that avoids problems because it better handles "modules" and "options" within SoutChains.
The first and second patches are drop-in replacement for the current implementation.
Then the third patch actually fixes the bug.

To reproduce the bug:
* open VLC, then "Open capture device" (I am not using the English version, my description can be slightly wrong)
* Choose whatever source you want, e.g. screen
* Choose "convert"
* Choose a profile, and edit it. In the "video codec" tab, add a custom argument (e.g. "preset=faster", which makes sense with the x264 codec). This is the part that adds a brace in the sout chain.
* Start the convert process. VLC will fail because the sout chain will lack a closing brace.
  You can see the sout chain in the "messages" dialog.
  Without my patch, the chain may look like sout=#transcode{vcodec=MJPG,venc=x264{preset=faster,scale=Auto,acodec=mp4a,ab=128,channels=1,samplerate=44100,scodec=none,deinterlace}:std{access=file{no-overwrite},mux=mp4,dst='/path/to/output.mp4'} whereas my patch correctly handles the closing brace

These patches can be applied (almost painlessly) to the 3.0.8 branch (there may only be slight issues with a Makefile.am and a convert.cpp that was slightly changed)

Jérôme Froissart (23:
  qt: rename SoutMrl to SoutChain
  qt: re-implement SoutChain in a more object-oriented way
  fix: Deinterlace can be associated with codec arguments

 modules/gui/qt/Makefile.am                    |   1 +
 .../qt/components/sout/profile_selector.cpp   |  79 +++++----
 .../qt/components/sout/profile_selector.hpp   |   5 +-
 .../gui/qt/components/sout/sout_widgets.cpp   |  37 ++---
 modules/gui/qt/dialogs/convert.cpp            |  37 +++--
 modules/gui/qt/dialogs/sout.cpp               |  42 ++---
 modules/gui/qt/dialogs/sout.hpp               |  78 +--------
 modules/gui/qt/dialogs/vlm.cpp                |   4 +-
 modules/gui/qt/dialogs_provider.cpp           |   4 +-
 modules/gui/qt/util/soutchain.cpp             | 113 +++++++++++++
 modules/gui/qt/util/soutchain.hpp             | 150 ++++++++++++++++++
 11 files changed, 378 insertions(+), 172 deletions(-)
 create mode 100644 modules/gui/qt/util/soutchain.cpp
 create mode 100644 modules/gui/qt/util/soutchain.hpp


More information about the vlc-devel mailing list