question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

output redirected to file contains terminal sequences

See original GitHub issue

Checklist

  • I’m reporting a bug unrelated to a specific site
  • I’ve verified that I’m running yt-dlp version 2022.03.08.1. (update instructions)
  • I’ve checked that all provided URLs are alive and playable in a browser
  • I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
  • I’ve searched the bugtracker for similar issues including closed ones. DO NOT post duplicates
  • I’ve read the guidelines for opening an issue

Description

When redirecting yt-dlp’s output to a file terminal sequences are not suppressed. Either at the beginning or the end you will find strings like ]0;yt-dlp Concat started]0;yt-dlp Concat finished.

Prerequisites to reproduce:

  • run yt-dlp in POSIX shell ($TERM=xterm-256color)
  • use yt-dlp version >= 2022.1.21
  • the url must refer to a playlist
  • parameter --console-title is set
  • parameter --concat-playlist is set to always or multi_video

Verbose log

$ yt-dlp --no-config --verbose --console-title --dump-single-json https://www.youtube.com/channel/UCUBl5r0qPEY7130xVVWv6Zw > dump.json
[debug] Command-line config: ['--no-config', '--verbose', '--console-title', '--dump-single-json', 'https://www.youtube.com/channel/UCUBl5r0qPEY7130xVVWv6Zw']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8 (No ANSI), err utf-8, pref UTF-8
[debug] yt-dlp version 2022.03.08.2 [e491d06d3]
[debug] Python version 3.10.2 (CPython 64bit) - Linux-4.19.104-microsoft-standard-x86_64-with-glibc2.31
[debug] exe versions: ffmpeg 4.2.4, ffprobe 4.2.4
[debug] Optional libraries: brotli, Cryptodome, mutagen, sqlite, websockets
[debug] Proxy map: {}
[debug] [youtube:tab] Extracting URL: https://www.youtube.com/channel/UCUBl5r0qPEY7130xVVWv6Zw
[youtube:tab] UCUBl5r0qPEY7130xVVWv6Zw: Downloading webpage
[youtube:tab] A channel/user page was given. All the channel's videos will be downloaded. To download only the videos in the home page, add a "/featured" to the URL
[debug] [youtube:tab] Final URL: https://www.youtube.com/channel/UCUBl5r0qPEY7130xVVWv6Zw/videos
[download] Downloading playlist: Martin Schulz - Videos
[youtube:tab] playlist Martin Schulz - Videos: Downloading 0 videos
[download] Finished downloading playlist: Martin Schulz - Videos

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
pukkandancommented, Mar 11, 2022

In UNIX, console title is set by sending a code to stdout. I can’t figure out how to change the title when stdout is being piped to a file. So for now, I’ll just forcefully disable --console-title in such cases

0reactions
pukkandancommented, Mar 11, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Terminal Output Redirected to a File - Ask Ubuntu
The command you're executing ( minicom ) is using "VT100 Escape Sequences" to do cursor positioning. To remove the characters listed above, ...
Read more >
Redirection – Introduction to the Command Line for Genomics
This command returns a lot of output to the terminal. Every single line in the SRR098026 file that contains at least 10 consecutive...
Read more >
Prevent tput escape sequences when redirecting script output ...
I am facing a problem with this technique. I have 2 .sh scripts, both using the technique, and both echoing colored output. The...
Read more >
Command output redirect to file and terminal - Stack Overflow
I am doing following and it appending to file but not printing ls output on terminal. $ls 2>&1 > /tmp/ls.txt. linux · bash...
Read more >
The Shell: Searching and Redirection - GitHub Pages
The redirection command for writing something to file is > . Let's try it out and put all the sequences that contain 'NNNNNNNNNN'...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found