Repository: yt-dlp
Issue: Allow Skipping Video Download on --exec "before_dl" Failure
Labels: enhancement,triage

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm requesting a feature unrelated to a specific site
- [X] I've looked through the [README](https://github.com/yt-dlp/yt-dlp#readme)
- [X] I've verified that I'm running yt-dlp version **2023.03.04** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)

### Provide a description that is worded well enough to be understood

Currently, it appears that whenever a preprocessing script fails, yt-dlp simply logs that the command exited with a non-zero status code, and the code itself. I'm attempting to do some more complex archiving using some pre-process and post-processing scripts. Part of the process is that the pre-process script will check the video id against a logfile that contains the video id and the filepath that video was saved at, a feature not native to yt-dlp. 

My hope was that by returning a non-zero exit code, yt-dlp would skip the video, or otherwise provide an option to specify that that was the behavior I desired. However, looking through all the options available it doesn't appear to be the case. This behavior also seems inconsistent with the behavior when downloading playlists, where if an error is discovered yt-dlp skips that video and attempts the next video, along with having options to specify how that behavior should exactly work.

I believe the easiest solution to this would be to provide some flag, --skip-on-exec-error, to specify that I would prefer yt-dlp to skip the video download if an error occurs. Alternatively, it might make sense to make the default behavior skipping, to match how playlist downloading works, and provide the inverse flag --no-skip-on-exec-error or similar.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['-vU', '--format', 'bestvideo+bestaudio', '--write-thumbnail', '--embed-thumbnail', '--all-subs', '--sub-lang', 'en', '--embed-subs', '--add-metadata', '--write-info-json', '--exec', "before_dl:bash ./process_video.sh preprocess '/Users/aargonian/Movies/Downloads/%(uploader)s/%(title)s - %(uploader)s.%(ext)s'", '--exec', "after_move:bash ./process_video.sh postprocess '/Users/aargonian/Movies/Downloads/%(uploader)s/%(title)s - %(uploader)s.%(ext)s'", '--exec', "after_move:bash ./process_video.sh cleanup '/Users/aargonian/Movies/Downloads/%(uploader)s/%(title)s - %(uploader)s.%(ext)s'", '--output', '/Users/aargonian/Movies/Downloads/%(uploader)s/%(title)s - %(uploader)s.%(ext)s', 'https://www.youtube.com/watch?v=1O0yazhqaxs']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8 (No ANSI), error utf-8 (No ANSI), screen utf-8 (No ANSI)
[debug] yt-dlp version stable@2023.03.04 [392389b7d] (pip)
[debug] Python 3.11.3 (CPython arm64 64bit) - macOS-13.3.1-arm64-arm-64bit (OpenSSL 1.1.1t  7 Feb 2023)
[debug] exe versions: ffmpeg 6.0 (setts), ffprobe 6.0
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1786 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.03.04, Current version: stable@2023.03.04
yt-dlp is up to date (stable@2023.03.04)
[youtube] Extracting URL: https://www.youtube.com/watch?v=1O0yazhqaxs
[youtube] 1O0yazhqaxs: Downloading webpage
[youtube] 1O0yazhqaxs: Downloading android player API JSON
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, filesize, fs_approx, tbr, vbr, abr, asr, vext, aext, hasaud, id
[info] 1O0yazhqaxs: Downloading 1 format(s): 248+251
[info] There's no subtitles for the requested languages
[info] Downloading video thumbnail 46 ...
[info] Writing video thumbnail 46 to: /Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.webp
[info] Writing video metadata as JSON to: /Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.info.json
[Exec] Executing command: bash ./process_video.sh preprocess '/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.webm'
/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.webm
Found a copy of the video already. Linking
ERROR: Preprocessing: Command returned error code 1
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/yt-dlp/2023.3.4/libexec/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3491, in pre_process
    info = self.run_all_pps(key, info)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yt-dlp/2023.3.4/libexec/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3484, in run_all_pps
    info = self.run_pp(pp, info)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yt-dlp/2023.3.4/libexec/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3462, in run_pp
    files_to_delete, infodict = pp.run(infodict)
                                ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yt-dlp/2023.3.4/libexec/lib/python3.11/site-packages/yt_dlp/postprocessor/common.py", line 24, in run
    ret = func(self, info, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yt-dlp/2023.3.4/libexec/lib/python3.11/site-packages/yt_dlp/postprocessor/exec.py", line 33, in run
    raise PostProcessingError('Command returned error code %d' % retCode)
yt_dlp.utils.PostProcessingError: Command returned error code 1

WARNING: webm doesn't support embedding a thumbnail, mkv will be used
[debug] Invoking dashsegments downloader on "https://rr3---sn-vgqskn6s.googlevideo.com/videoplayback?expire=1684653132&ei=7G9pZKjEGbiL2_gPzv6M6AQ&ip=68.188.16.146&id=o-AEZOF2fnMQC4LW880enwF-3sL6LgtStpPlpmTPvMlz7x&itag=248&source=youtube&requiressl=yes&mh=bD&mm=31%2C29&mn=sn-vgqskn6s%2Csn-vgqsrnes&ms=au%2Crdu&mv=m&mvi=3&pl=17&initcwndbps=1480000&spc=qEK7B0acELfKg-0jKeAsBCtryMoxcGE&vprv=1&svpuc=1&mime=video%2Fwebm&gir=yes&clen=11018&dur=3.000&lmt=1639741294637808&mt=1684631354&fvip=4&keepalive=yes&fexp=24007246%2C24362686&c=ANDROID&txp=5316222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgC-sWfovmai0x-cIGI2noMPt29np_4n2Y5ER3biqe3MoCIFC9RgpzF_sKn_N0h9oB5-36e6Ls2ycmXacBytaivzZ0&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhALsgOcCxSXZIeZxO9DCfNfg2ZLeoKtKaZrUwyLN14-YwAiBL6QkLQCUqwrfhE8XwgP0TkS83AHgK9mSP9BNOrCNPMQ%3D%3D"
[dashsegments] Total fragments: 1
[download] Destination: /Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.f248.webm

[download]   9.3% of ~  10.76KiB at    2.59KiB/s ETA 00:03 (frag 0/1)
[download]  27.9% of ~  10.76KiB at    7.75KiB/s ETA 00:01 (frag 0/1)
[download]  65.1% of ~  10.76KiB at   18.04KiB/s ETA 00:00 (frag 0/1)
[download] 100.0% of ~  10.76KiB at   27.67KiB/s ETA 00:00 (frag 0/1)
[download] 100.0% of ~  10.76KiB at   27.55KiB/s ETA 00:00 (frag 1/1)
[download] 100% of   10.76KiB in 00:00:00 at 27.42KiB/s              
[debug] Invoking dashsegments downloader on "https://rr3---sn-vgqskn6s.googlevideo.com/videoplayback?expire=1684653132&ei=7G9pZKjEGbiL2_gPzv6M6AQ&ip=68.188.16.146&id=o-AEZOF2fnMQC4LW880enwF-3sL6LgtStpPlpmTPvMlz7x&itag=251&source=youtube&requiressl=yes&mh=bD&mm=31%2C29&mn=sn-vgqskn6s%2Csn-vgqsrnes&ms=au%2Crdu&mv=m&mvi=3&pl=17&initcwndbps=1480000&spc=qEK7B0acELfKg-0jKeAsBCtryMoxcGE&vprv=1&svpuc=1&mime=audio%2Fwebm&gir=yes&clen=1653&dur=3.021&lmt=1639741291263993&mt=1684631354&fvip=4&keepalive=yes&fexp=24007246%2C24362686&c=ANDROID&txp=5311222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgBx8gX--ioe3MXIEropL5U2lLGy4dTO4zV1VFxqtmJ10CIDyf_CMi1iOlx02EyGhRwZCK_mVVWl1HBAkyszQ5YpIW&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhALsgOcCxSXZIeZxO9DCfNfg2ZLeoKtKaZrUwyLN14-YwAiBL6QkLQCUqwrfhE8XwgP0TkS83AHgK9mSP9BNOrCNPMQ%3D%3D"
[dashsegments] Total fragments: 1
[download] Destination: /Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.f251.webm

[download]  61.9% of ~   1.61KiB at    3.33KiB/s ETA 00:00 (frag 0/1)
[download] 100.0% of ~   1.61KiB at    5.35KiB/s ETA 00:00 (frag 0/1)
[download] 100.0% of ~   1.61KiB at    5.33KiB/s ETA 00:00 (frag 1/1)
[download] 100% of    1.61KiB in 00:00:00 at 5.31KiB/s               
ERROR: Preprocessing: Command returned error code 1
[Merger] Merging formats into "/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.mkv"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.f248.webm' -i 'file:/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.f251.webm' -c copy -map 0:v:0 -map 1:a:0 -movflags +faststart 'file:/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.temp.mkv'
Deleting original file /Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.f248.webm (pass -k to keep)
Deleting original file /Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.f251.webm (pass -k to keep)
[EmbedSubtitle] There aren't any subtitles to embed
[debug] ffprobe command line: ffprobe -hide_banner -show_format -show_streams -print_format json 'file:/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.mkv'
[Metadata] Adding metadata to "/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.mkv"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.mkv' -map 0 -dn -ignore_unknown -c copy -write_id3v1 1 -metadata 'title=3 Second Video' -metadata date=20190909 -metadata 'description=3 second video for testing purposes.

Three Second Test Video Grey:
https://youtu.be/1O0yazhqaxs

Three Second Test Video Blue
https://youtu.be/18DYQVYKqTU

Three Second Test Video Red
https://youtu.be/-c4yVUrVCzw

Three Second Test Video Green
https://youtu.be/gkZEhCeeXkI

More test videos and other videos check out:
https://www.youtube.com/channel/UC68aZJBtTXowhmMW97Tljkw?sub_confirmation=1' -metadata 'synopsis=3 second video for testing purposes.

Three Second Test Video Grey:
https://youtu.be/1O0yazhqaxs

Three Second Test Video Blue
https://youtu.be/18DYQVYKqTU

Three Second Test Video Red
https://youtu.be/-c4yVUrVCzw

Three Second Test Video Green
https://youtu.be/gkZEhCeeXkI

More test videos and other videos check out:
https://www.youtube.com/channel/UC68aZJBtTXowhmMW97Tljkw?sub_confirmation=1' -metadata 'purl=https://www.youtube.com/watch?v=1O0yazhqaxs' -metadata 'comment=https://www.youtube.com/watch?v=1O0yazhqaxs' -metadata 'artist=Matthew McDonald' -attach '/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.info.json' -metadata:s:2 mimetype=application/json -metadata:s:2 filename=info.json -movflags +faststart 'file:/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.temp.mkv'
[debug] ffprobe command line: ffprobe -hide_banner -show_format -show_streams -print_format json 'file:/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.mkv'
[EmbedThumbnail] ffmpeg: Adding thumbnail to "/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.mkv"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.mkv' -map 0 -dn -ignore_unknown -c copy -attach '/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.webp' -metadata:s:3 mimetype=image/webp -metadata:s:3 filename=cover.webp -movflags +faststart 'file:/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.temp.mkv'
[Exec] Executing command: bash ./process_video.sh postprocess '/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.mkv'
/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.mkv
/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald
[Exec] Executing command: bash ./process_video.sh cleanup '/Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.mkv'
rm: /Users/aargonian/Movies/Downloads/Matthew McDonald/3 Second Video - Matthew McDonald.jpg: No such file or directory
```