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

Jérôme Froissart software at froissart.eu
Thu Oct 10 16:32:57 CEST 2019


(I have already posted about this issue, but I am not sure I used git correctly to send my mails. You can ignore my previous post)

When converting a video, an MRL is poorly handled.
When the user checks the "deinterlace" option in the GUI, convert.cpp inserts ",deinterlace" into the MRL without properly checking for braces. This causes issues in case the passed mrl 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 mrl before inserting the "deinterlace" statement, but, well...that would be quick-and-dirty.
I rather send you a more object-oriented implementation of SoutMrl, that avoids problems because it better handles "modules" and "options" within SoutMrls.
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 MRL.
* Start the convert process. VLC will fail because the MRL will lack a closing brace.
  You can see the MRL in the "messages" dialog.
  Without my patch, the MRL 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

Sorry, I did not know what to put in the .hpp header, I could have copied/pasted the GPL license, but I do not know how to properly set the copyright. Maybe you'll know this better than I do.

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 (3):
  Re-implemented SoutMrl in a more object-oriented way
  Additions to the new soutmrl implementation
  Deinterlace can be associated with codec arguments

 modules/gui/qt/Makefile.am                    |   1 +
 .../qt/components/sout/profile_selector.cpp   |  80 +++++-----
 .../qt/components/sout/profile_selector.hpp   |   5 +-
 .../gui/qt/components/sout/sout_widgets.cpp   |   1 +
 modules/gui/qt/dialogs/convert.cpp            |  37 +++--
 modules/gui/qt/dialogs/sout.cpp               |   4 +-
 modules/gui/qt/dialogs/sout.hpp               |  71 +--------
 modules/gui/qt/util/soutmrl.cpp               |  86 +++++++++++
 modules/gui/qt/util/soutmrl.hpp               | 144 ++++++++++++++++++
 9 files changed, 300 insertions(+), 129 deletions(-)
 create mode 100644 modules/gui/qt/util/soutmrl.cpp
 create mode 100644 modules/gui/qt/util/soutmrl.hpp


More information about the vlc-devel mailing list