Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpeg: you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to. #294

Closed
sofeikov opened this issue Nov 22, 2017 · 2 comments · Fixed by #321

Comments

@sofeikov
Copy link

sofeikov commented Nov 22, 2017

I'm trying to get imageio reading only I-frames with ffmpeg plugin. Therefore, I'm using the following line in python:

video_reader = imageio.get_reader(video_path, 'ffmpeg', ffmpeg_params=['-vf', 'select eq(pict_type\,PICT_TYPE_I)'])

During the initialisation I get the following message from ffmpeg:

ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3) configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --disable-ffserver --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libtheora --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab --enable-libwavpack --enable-nvenc --enable-libzimg libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat 57. 71.100 / 57. 71.100 libavdevice 57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libavresample 3. 5. 0 / 3. 5. 0 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 libpostproc 54. 5.100 / 54. 5.100 Option vf (set video filters) cannot be applied to input url /home/konsof01/Work/FaceBackend/TestData/TestMedia/me.mp4 -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to. Error parsing options for input file /home/konsof01/Work/FaceBackend/TestData/TestMedia/me.mp4. Error opening input files: Invalid argument

The end of this message clearly says that the given option is being put into a wrong place. Is this by-design or am I doing something wrong?

Is it a good idea to have a way to tell that some options are for output files, not for input?

Thanks,
Konstantin

@sofeikov
Copy link
Author

I strongly suspect that the problem is here

https://github.com/imageio/imageio/blob/master/imageio/plugins/ffmpeg.py#L423

All additional arguments given are being put in front of filename given.

@almarklein
Copy link
Member

In #321 I added that one can specify input_params and output_params. The old ffmpeg_params still works (maps to input_params when reading and output_params when writing).

almarklein added a commit that referenced this issue Mar 13, 2018
* ffmpeg: allow more control over ffmpeg params (#294)

* Refactor ffmpeg info parsing a bit, so we can test it easier

* fixes for getting ffmpeg fps

* ffmpeg: new fps param for reading, to overload files fps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants