#310 mp4box is unable to process files with apostrophe (') in the filename

v1.0 (example)

mp4box (svn trunk as of today as well as older versions) is unable to process files that contain a apostrophe (') in the filename:

$ ./MP4Box -v -enable 3 "test'.mp4"
Saving test'.mp4: 0.500 secs Interleaving
Error renaming file out_test'.mp4 to test'.mp4

please fix this or give me a hint how to do it myself


  • Jean Le Feuvre

    Jean Le Feuvre - 2014-05-12

    Hmm which platform are you using ? latest SVN works fine for that on windows/OSX/ubuntu ...

  • Julian

    Julian - 2014-05-12

    i'm on Mac OS X 10.9.2

    SVN r5244

  • Jean-Claude Dufourd

    I'm also using Mac OSX 10.9.2, on r5254 now.
    I confirm the bug, but not with that command line.
    I have tried with a file whose track 3 is enabled, so I need to -disable it to get mp4box to rewrite the file.

    Last edit: Jean-Claude Dufourd 2014-05-14
  • Julian

    Julian - 2014-05-14

    yes the problem only happens when the file is actually modified and written out. need to use "enable" or "disable" to make sure a change is actually ocurring.

  • Romain Bouqueau

    Romain Bouqueau - 2014-05-14

    I know what happens. Our rename function internally relies on "mv 'file1' 'file2'". Look at the quotes. So if your filename includes a single quote, it indeed doesn't work.

    NB: we needed to rely on "mv" otherwise changes to different filesystems were not taken correctly into account.

    NB2: commit adding the quotes https://sourceforge.net/p/gpac/code/4410/

    Does any of you can see an easy way to fix this?

  • Julian

    Julian - 2014-05-14

    if you
    1.) change the MV command to use double quotes instead of single quotes
    2.) make sure the filenames are properly escaped with backslashes (perhaps this already is done?)

    it should work. tested ad-hoc on the command line

  • Romain Bouqueau

    Romain Bouqueau - 2014-05-14

    Ok, that's much complex than that. If you set double-quote, the system() function (which relies on '/bin/sh' on Unix) may interpret many symbols which is not security-proof.

    I'm having a look...

  • Julian

    Julian - 2014-05-14

    thanks this fixes the issue for me.

    since the "Error renaming file" errors seem to crop up every few years on different platforms, perhaps files with exotic filenames could be added to the testsuite

    “}Ωª}a a“¡ª¡“¶¢®¢.mp4
    "œƒ@∑∆¡||¡ ±±-.mp4



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks