Opened 6 years ago

Closed 6 years ago

#2127 closed defect (fixed)

-- does not separate options and arguments before

Reported by: phihag Owned by:
Priority: important Component: ffmpeg
Version: git-master Keywords: regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

To convert the file -dash.mp4 to -dash.mp3, ffmpeg 0.11 allowed

% ffmpeg -i -dash.mp3 -- -dash.mp4

In ffmpeg 1.1 (and git 4765f635387cef3efb01e52e59d4f3add126a0e2 ), this fails:

% ffmpeg -i -dash.mp3 -- -dash.mp4
ffmpeg version 1.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan  8 2013 10:32:41 with gcc 4.7 (Debian 4.7.2-5)
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --disable-decoder=libdirac --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-libvpx --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libdc1394 --disable-altive  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Unrecognized option '-'.
Error splitting the argument list: Option not found

While it is possible to escape file names by prepending ./, doing is nontrivial in a script, since one has to consider absolute filenames as well. The -- convention is widely supported, not only by ffmpeg-0.11, but also GNU coreutils, bash, gcc, etc.

Change History (7)

comment:1 Changed 6 years ago by nerdinand

I just did a git bisect and it looks like af4b1c02acf6923489d30349c4813a0d73b2f114 introduced this defect.

comment:2 Changed 6 years ago by cehoyos

I don't think this is a regression since it did not work correctly before:

$ ffmpeg -i tests/lena.pnm -s 128x128 -- -out.png -s 512x512 out.jpg
ffmpeg version N-48018-g52b8664 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jan  9 2013 23:22:29 with gcc 4.7 (SUSE Linux)
  configuration:
  libavutil      52. 12.100 / 52. 12.100
  libavcodec     54. 80.100 / 54. 80.100
  libavformat    54. 49.102 / 54. 49.102
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 28.102 /  3. 28.102
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
Input #0, image2, from 'tests/lena.pnm':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: ppm, rgb24, 256x256, 25 tbr, 25 tbn, 25 tbc
[NULL @ 0x27f27c0] Unable to find a suitable output format for '-s'
-s: Invalid argument

The following works as expected with current git head:

ffmpeg -i tests/lena.pnm -s 128x128 ./-out.png -s 512x512 ./-out.jpg

comment:3 follow-up: Changed 6 years ago by nerdinand

The idea of the double dash is to have only the file name to come after it. It marks the end of command options. Refer to this answer on StackExchange?: http://unix.stackexchange.com/a/11382

comment:4 in reply to: ↑ 3 ; follow-up: Changed 6 years ago by cehoyos

Replying to nerdinand:

The idea of the double dash is to have only the file name to come after it. It marks the end of command options.

But since FFmpeg command lines must be able to accept different options between different output file names, I don't think the double dash can be used with FFmpeg. Or do I miss something?

comment:5 in reply to: ↑ 4 Changed 6 years ago by nerdinand

Replying to cehoyos:

But since FFmpeg command lines must be able to accept different options between different output file names, I don't think the double dash can be used with FFmpeg. Or do I miss something?

Yes, that does make sense, I think you are right. In any case I can imagine this might break some scripts using ffmpeg. The only possible solution would be to enable the double dash when only one output file is specified.

comment:6 Changed 6 years ago by cehoyos

  • Keywords regression added
  • Priority changed from normal to important

comment:7 Changed 6 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from new to closed

The behaviour has changed in current git head so that the following command line produces a 128x128 png and a 512x512 jpg.

$ ffmpeg -i tests/lena.pnm -s 128x128 -- -out.png -s 512x512 -- -out.jpg
Note: See TracTickets for help on using tickets.