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

FFmpegPostProcessorError: Filtering and streamcopy cannot be used together. #13511

Closed
winstonliu opened this issue Jun 28, 2017 · 3 comments
Closed
Labels

Comments

@winstonliu
Copy link

@winstonliu winstonliu commented Jun 28, 2017

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2017.06.25. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2017.06.25

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add -v flag to your command line you run youtube-dl with, copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

user@user:~/Videos/misc$ youtube-dl -v https://www.youtube.com/watch?v=Nyw4rTywyY0
[debug] System config: []
[debug] User config: [u'-x', u'-o', u'%(title)s.mp3', u'--postprocessor-args', u'-filter:a atempo=1.25']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'https://www.youtube.com/watch?v=Nyw4rTywyY0']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.06.25
[debug] Python version 2.7.12 - Linux-4.4.0-81-generic-x86_64-with-Ubuntu-16.04-xenial
[debug] exe versions: ffmpeg 2.8.11-0ubuntu0.16.04.1, ffprobe 2.8.11-0ubuntu0.16.04.1
[debug] Proxy map: {}
[youtube] Nyw4rTywyY0: Downloading webpage
[youtube] Nyw4rTywyY0: Downloading video info webpage
[youtube] Nyw4rTywyY0: Extracting video information
[youtube] Nyw4rTywyY0: Downloading MPD manifest
[debug] Invoking downloader on u'https://r5---sn-cxaaj5o5q5-tt1l.googlevideo.com/videoplayback?id=372c38ad3cb0c98d&itag=140&source=youtube&requiressl=yes&mn=sn-cxaaj5o5q5-tt1l&pl=22&initcwndbps=1927500&mv=m&ms=au&mm=31&ei=wxJTWZUph_4NgaqF2Ac&ratebypass=yes&mime=audio/mp4&gir=yes&clen=116109407&lmt=1497979072572737&dur=7310.523&mt=1498616436&signature=2F1D9A6388701B8B81C1FDAE28B55DAEF293CB07.678FCF6B0105120EAD0AFE8AA5B946F0C157DF6D&key=dg_yt0&ip=50.101.173.36&ipbits=0&expire=1498638115&sparams=ip,ipbits,expire,id,itag,source,requiressl,mn,pl,initcwndbps,mv,ms,mm,ei,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: Strategy (1) - 12 principles for a 21st century conservatism.mp3
[download] 100% of 110.73MiB in 00:41
[ffmpeg] Correcting container in "Strategy (1) - 12 principles for a 21st century conservatism.mp3"
[debug] ffmpeg command line: ffmpeg -y -i 'file:Strategy (1) - 12 principles for a 21st century conservatism.mp3' -c copy -f mp4 '-filter:a' 'atempo=1.25' 'file:Strategy (1) - 12 principles for a 21st century conservatism.temp.mp3'
ERROR: Filtering and streamcopy cannot be used together.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 1973, in post_process
    files_to_delete, info = pp.run(info)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/postprocessor/ffmpeg.py", line 530, in run
    self.run_ffmpeg(filename, temp_filename, options)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/postprocessor/ffmpeg.py", line 208, in run_ffmpeg
    self.run_ffmpeg_multiple_files([path], out_path, opts)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/postprocessor/ffmpeg.py", line 204, in run_ffmpeg_multiple_files
    raise FFmpegPostProcessorError(msg)
FFmpegPostProcessorError: Filtering and streamcopy cannot be used together.

Description of your issue, suggested solution and other information

FFmpeg doesn't like it when the copy command and the filter command are in the same line.
I don't know how important the -c copy -f mp4 flags are.
When I take them out, the following command works just fine.

user@user:~/Videos/misc$ ffmpeg -y -i 'file:Strategy (1) - 12 principles for a 21st century conservatism.mp3' '-filter:a' 'atempo=1.25' 'file:Strategy (1) - 12 principles for a 21st century conservatism.temp.mp3'

Configuration File:

#~/.config/youtube-dl/config
# Only Audio
-x

# Speed up audio
--postprocessor-args "-filter:a atempo=1.25"

OS:

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:        16.04
Codename:       xenial

FFmpeg flags:

built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jun 28, 2017

  1. -c copy is important.
  2. Do not hardcode extension in output template.
@dstftw dstftw closed this Jun 28, 2017
@dstftw dstftw added the invalid label Jun 28, 2017
@winstonliu
Copy link
Author

@winstonliu winstonliu commented Jun 28, 2017

That doesn't resolve the underlying issue.
See log below with output name changed to %(title).%(ext)s

$ youtube-dl -v https://www.youtube.com/watch?v=Nyw4rTywyY0      
[debug] System config: []
[debug] User config: [u'-x', u'-o', u'%(title)s.%(ext)s', u'--postprocessor-args', u'-filter:a atempo=1.25']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'https://www.youtube.com/watch?v=Nyw4rTywyY0']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.06.25
[debug] Python version 2.7.12 - Linux-4.4.0-81-generic-x86_64-with-Ubuntu-16.04-xenial
[debug] exe versions: ffmpeg 2.8.11-0ubuntu0.16.04.1, ffprobe 2.8.11-0ubuntu0.16.04.1
[debug] Proxy map: {}
[youtube] Nyw4rTywyY0: Downloading webpage
[youtube] Nyw4rTywyY0: Downloading video info webpage
[youtube] Nyw4rTywyY0: Extracting video information
WARNING: unable to extract uploader nickname
[youtube] Nyw4rTywyY0: Downloading MPD manifest
[debug] Invoking downloader on u'https://r5---sn-cxaaj5o5q5-tt1l.googlevideo.com/videoplayback?id=372c38ad3cb0c98d&itag=140&source=youtube&requiressl=yes&initcwndbps=2082500&mv=m&ei=ViJTWY_oFYeoDK3NnPAI&ms=au&mm=31&mn=sn-cxaaj5o5q5-tt1l&pl=22&ratebypass=yes&mime=audio/mp4&gir=yes&clen=116109407&lmt=1497979072572737&dur=7310.523&signature=2B118F73CF0FA805AD4BD5EF1EF1F95181ACB71C.4E47E46565989881622FDD5A0D009654EE999B11&key=dg_yt0&mt=1498620403&ip=50.101.173.36&ipbits=0&expire=1498642102&sparams=ip,ipbits,expire,id,itag,source,requiressl,initcwndbps,mv,ei,ms,mm,mn,pl,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: Strategy (1) - 12 principles for a 21st century conservatism.m4a
[download] 100% of 110.73MiB in 00:42
[ffmpeg] Correcting container in "Strategy (1) - 12 principles for a 21st century conservatism.m4a"
[debug] ffmpeg command line: ffmpeg -y -i 'file:Strategy (1) - 12 principles for a 21st century conservatism.m4a' -c copy -f mp4 '-filter:a' 'atempo=1.25' 'file:Strategy (1) - 12 principles for a 21st century conservatism.temp.m4a'
ERROR: Filtering and streamcopy cannot be used together.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 1973, in post_process
    files_to_delete, info = pp.run(info)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/postprocessor/ffmpeg.py", line 530, in run
    self.run_ffmpeg(filename, temp_filename, options)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/postprocessor/ffmpeg.py", line 208, in run_ffmpeg
    self.run_ffmpeg_multiple_files([path], out_path, opts)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/postprocessor/ffmpeg.py", line 204, in run_ffmpeg_multiple_files
    raise FFmpegPostProcessorError(msg)
FFmpegPostProcessorError: Filtering and streamcopy cannot be used together.
@winstonliu
Copy link
Author

@winstonliu winstonliu commented Jun 28, 2017

I've found the source of the issue and came up with a workaround. Putting it here for posterity's sake.

Issue

When specifying the -x flag, --postprocessor-args appends the commands to the ffmpeg -y -i 'file:title.m4a' -c copy -f mp4 'file:title.temp.m4a line.

This is a streamcopy command. FFmpeg doesn't decode and re-encode the audio in this command. Conversely, the command I was trying to run (-filter:a atempo=1.25) is a filtergraph command, which does require re-encoding.

FFmpeg doesn't allow mixing of streamcopy and filtergraphs. With the current configuration --postprocessor-args must be streamcopy commands when the -x flag is set. It would be nice if this were documented.

Workaround

Use the --exec flag to run ffmpeg after the fact. I would like to run the atempo command at the same time as the libmp3lame transcoding, but unfortunately that's not possible at the moment.

#~/.config/youtube-dl/config
# Only Audio
-x

--audio-format "mp3"

-o "%(title)s.%(ext)s"

# Speed up audio
--exec "mv {} temp; ffmpeg -i temp -filter:a atempo=1.25 {}; rm temp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.