I'm trying to create a tar file on windows using 7zip.
Most of the documents I found said to do something like this:
7z a -ttar -so dwt.tar dwt/
But when I tried to run it I got this error:
Command Line Error:
I won't write compressed data to a terminal
I'm currently using 7-Zip [64] 16.04
Any idea?
On Linux:
tar cf - <source folder> | 7z a -si <Destination archive>.tar.7z
from here
On Windows:
7za.exe a -ttar -so archive.tar source_files | 7za.exe a -si archive.tgz
from here.
I managed to do that making simply, with 7zip installed:
Right click on the folder you want to compress
Choose -7zip/add to file
Once there, on the new screen, on file type, you can choose 7z/tar/wim/zip
Choose tar, and there you go :)
From the manpage:
-so Write data to stdout (e.g. 7z x -so directory.tar.7z | tar xf -)
It does what you told it to. 7z can guess archive format from the file extension so it's enough to use
7z a archive.tar input/
To further compress as gzip you can use a pipe and a combination of stdin and stdout flags like in Tu.Ma.'s answer.
I want to download an AUDIO-ONLY playlist using youtube-dl. I've got the basics down. My version of youtube-dl is up to date, and the command I'm using is:
youtube-dl -x --extract-audio --yes-playlist --playlist-start 1 --playlist-end 18 \
https://www.youtube.com/watch?v=NRHoSXxTpgI&index=1&list=OLAK5uy_lowZyOuAZVs41vEtzV6e0KU8Iue1YQlzg
But it keeps getting stuck on
Deleting original file [filename] (pass -k to keep)
Github doesn't seem to be of any help: https://github.com/rg3/youtube-dl/issues/12570
Any ideas?
The ampersand (&) is a special character in most shells, advising the shell to run the command so far in the background. This should be plainly visible in the first lines after the command execution, which will likely say something like
[1] 17156
[2] 17157
These is your shell telling you the process ID of the new background processes.
You must escape ampersands with a backslash or quotes, like this:
youtube-dl -x --yes-playlist --playlist-start 1 --playlist-end 18 \
'https://www.youtube.com/watch?v=NRHoSXxTpgI&index=1&list=OLAK5uy_lowZyOuAZVs41vEtzV6e0KU8Iue1YQlzg'
--extract-audio is the same as -x, and thus can be deleted.
For more information, see the youtube-dl FAQ.
-x = extract audio only
-i = ignore errors (skip unavailable files)
use only the 'list=...' part, delete the other parameters from copied URL
default is first to last
youtube-dl -ix https://www.youtube.com/watch?list=...
for individual tracks add e.g. --playlist-items 4,7-9
see also: github/ytdl-org: output template examples
Is it possible to use youtube-dl to download video from a .m3u8 stream file or other livestream formats?
When I copy the video URL into YouTube-dl it spits out:
[https # 0x7fc351416080] inflate return value: -3, incorrect header check
Last message repeated 15 times
After that it spits out of couple lines of red text that doesn't seem to want to copy in properly, so I took a snippet:
Does anyone know if this is possible?
I'll be using this Live Event from NASA TV as an example:
https://www.youtube.com/watch?v=21X5lGlDOfg
First, list the formats for the video:
youtube-dl --list-formats https://www.youtube.com/watch\?v\=21X5lGlDOfg
[youtube] 21X5lGlDOfg: Downloading webpage
[youtube] 21X5lGlDOfg: Downloading m3u8 information
[youtube] 21X5lGlDOfg: Downloading MPD manifest
[info] Available formats for 21X5lGlDOfg:
format code extension resolution note
91 mp4 256x144 HLS 197k , avc1.42c00b, 30.0fps, mp4a.40.5# 48k
92 mp4 426x240 HLS 338k , avc1.4d4015, 30.0fps, mp4a.40.5# 48k
93 mp4 640x360 HLS 829k , avc1.4d401e, 30.0fps, mp4a.40.2#128k
94 mp4 854x480 HLS 1380k , avc1.4d401f, 30.0fps, mp4a.40.2#128k
300 mp4 1280x720 3806k , avc1.4d4020, 60.0fps, mp4a.40.2 (best)
Pick the format you wish to download, and fetch the HLS m3u8 URL of the video from the manifest. I'll be using 94 mp4 854x480 HLS 1380k , avc1.4d401f, 30.0fps, mp4a.40.2#128k for this example:
youtube-dl -f 94 -g https://www.youtube.com/watch\?v\=21X5lGlDOfg
https://manifest.googlevideo.com/api/manifest/hls_playlist/expire/1592099895/ei/1y_lXuLOEsnXyQWYs4GABw/ip/81.190.155.248/id/21X5lGlDOfg.3/itag/94/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D135/hls_chunk_host/r5---sn-h0auphxqp5-f5fs.googlevideo.com/playlist_duration/30/manifest_duration/30/vprv/1/playlist_type/DVR/initcwndbps/8270/mh/N8/mm/44/mn/sn-h0auphxqp5-f5fs/ms/lva/mv/m/mvi/4/pl/16/dover/11/keepalive/yes/beids/9466586/mt/1592078245/disable_polymer/true/sparams/expire,ei,ip,id,itag,source,requiressl,ratebypass,live,goi,sgoap,sgovp,playlist_duration,manifest_duration,vprv,playlist_type/sig/AOq0QJ8wRgIhAM2dGSece2shUTgS73Qa3KseLqnf85ca_9u7Laz7IDfSAiEAj8KHw_9xXVS_PV3ODLlwDD-xfN6rSOcLVNBpxKgkRLI%3D/lsparams/hls_chunk_host,initcwndbps,mh,mm,mn,ms,mv,mvi,pl/lsig/AG3C_xAwRQIhAJCO6kSwn7PivqMW7sZaiYFvrultXl6Qmu9wppjCvImzAiA7vkub9JaanJPGjmB4qhLVpHJOb9fZyhMEeh1EUCd-3Q%3D%3D/playlist/index.m3u8
Note that link could be different and it contains expiration timestamp, in this case 1592099895 (about 6 hours).
Now that you have the HLS playlist, you can open this URL in VLC and save it using "Record", or write a small ffmpeg command:
ffmpeg -i \
https://manifest.googlevideo.com/api/manifest/hls_playlist/expire/1592099895/ei/1y_lXuLOEsnXyQWYs4GABw/ip/81.190.155.248/id/21X5lGlDOfg.3/itag/94/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D135/hls_chunk_host/r5---sn-h0auphxqp5-f5fs.googlevideo.com/playlist_duration/30/manifest_duration/30/vprv/1/playlist_type/DVR/initcwndbps/8270/mh/N8/mm/44/mn/sn-h0auphxqp5-f5fs/ms/lva/mv/m/mvi/4/pl/16/dover/11/keepalive/yes/beids/9466586/mt/1592078245/disable_polymer/true/sparams/expire,ei,ip,id,itag,source,requiressl,ratebypass,live,goi,sgoap,sgovp,playlist_duration,manifest_duration,vprv,playlist_type/sig/AOq0QJ8wRgIhAM2dGSece2shUTgS73Qa3KseLqnf85ca_9u7Laz7IDfSAiEAj8KHw_9xXVS_PV3ODLlwDD-xfN6rSOcLVNBpxKgkRLI%3D/lsparams/hls_chunk_host,initcwndbps,mh,mm,mn,ms,mv,mvi,pl/lsig/AG3C_xAwRQIhAJCO6kSwn7PivqMW7sZaiYFvrultXl6Qmu9wppjCvImzAiA7vkub9JaanJPGjmB4qhLVpHJOb9fZyhMEeh1EUCd-3Q%3D%3D/playlist/index.m3u8 \
-c copy output.ts
There is no need to pass anything to ffmpeg you can just grab the desired format, in this example, it was the "95" format.
So once you know that it is the 95, you just type:
youtube-dl -f 95 https://www.youtube.com/watch\?v\=6aXR-SL5L2o
that is to say:
youtube-dl -f <format number> <url>
It will begin generating on the working directory a <somename>.<probably mp4>.part which is the partially downloaded file, let it go and just press <Ctrl-C> to stop the capture.
The file will still be named <something>.part, rename it to <whatever>.mp4 and there it is...
The ffmpeg code:
ffmpeg -i $(youtube-dl -f <format number> -g <url>) -copy <file_name>.ts
also worked for me, but sound and video got out of sync, using just youtube-dl seemed to yield a better result although it too uses ffmpeg.
The downside of this approach is that you cannot watch the video while downloading, well you can open yet another FF or Chrome, but it seems that mplayer cannot process the video output till youtube-dl/ffmpeg are running.
Some websites with m3u streaming cannot be downloaded in a single youtube-dl step, you can try something like this :
$ URL=https://www.arte.tv/fr/videos/078132-001-A/cosmos-une-odyssee-a-travers-l-univers/
$ youtube-dl -F $URL | grep m3u
HLS_XQ_2 m3u8 1280x720 VA-STA, Allemand 2200k
HLS_XQ_1 m3u8 1280x720 VF-STF, Français 2200k
$ CHOSEN_FORMAT=HLS_XQ_1
$ youtube-dl -F "$(youtube-dl -gf $CHOSEN_FORMAT)"
[generic] master: Requesting header
[generic] master: Downloading webpage
[generic] master: Downloading m3u8 information
[info] Available formats for master:
format code extension resolution note
61 mp4 audio only 61k , mp4a.40.2
419 mp4 384x216 419k , avc1.66.30, mp4a.40.2
923 mp4 640x360 923k , avc1.77.30, mp4a.40.2
1737 mp4 720x406 1737k , avc1.77.30, mp4a.40.2
2521 mp4 1280x720 2521k , avc1.77.30, mp4a.40.2 (best)
$ youtube-dl --hls-prefer-native -f 1737 "$(youtube-dl -gf $CHOSEN_FORMAT $URL)" -o "$(youtube-dl -f $CHOSEN_FORMAT --get-filename $URL)"
[generic] master: Requesting header
[generic] master: Downloading webpage
[generic] master: Downloading m3u8 information
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 257
[download] Destination: Cosmos_une_odyssee_a_travers_l_univers__HLS_XQ_1__078132-001-A.mp4
[download] 0.9% of ~731.27MiB at 624.95KiB/s ETA 13:13
....
I have Written a small script to download the live youtube video, you may use as single command as well.
script it can be invoked simply as,
~/ytdl_lv.sh <URL> <output file name>
e.g.
~/ytdl_lv.sh https://www.youtube.com/watch?v=nX0sg1Gp-1 myfile.mp4
script is as simple as below,
#!/bin/bash
# ytdl_lv.sh
# Author Prashant
#
URL=$1
OUTNAME=$2
streamlink --hls-live-restart -o ${OUTNAME} ${URL} best
here the best is the stream quality, it also can be 144p (worst), 240p, 360p, 480p, 720p (best)
This answer has been completely rewritten on 19 Dec. 2022, after receiving the 6 downvotes.
How to download a live video? Follow the most-upvoted answer here, but use yt-dlp now wherever they use youtube-dl.
I recommend you use yt-dlp instead of youtube-dl. It's a fork off of youtube-dl and is much better-maintained and works much better. In the cases where youtube-dl gives me errors, yt-dlp works just fine. Also, in cases where youtube-dl downloads at 42 KiB/sec (which includes pretty much every time I use it--including 19 Dec. 2022 on Ubuntu 22.04), yt-dlp downloads at 86 MiB/sec, which is ~2100x faster, again, as tested on Ubuntu 22.04 seconds ago.
Tested on Ubuntu 22.04 on 19 Dec. 2022.
# Install yt-dlp
sudo apt update
sudo apt install yt-dlp
# Use it to download a video
# generally a smaller size; good quality
yt-dlp -f best https://www.youtube.com/watch?v=VUhQ6zEky0o
# bigger size; best quality
yt-dlp https://www.youtube.com/watch?v=VUhQ6zEky0o
See also my answer here where I explain this command a bit more: How to select video quality from youtube-dl?.
What youtube-dl errors did I see?
Tested on Ubuntu 18.04 and/or 20.04 on 28 Mar. 2021.
I tried following the the most-upvoted answer here but I'm getting the ERROR: VUhQ6zEky0o: YouTube said: Invalid parameters. error with youtube-dl and it's not working for me.
Sample live stream link: https://www.youtube.com/watch?v=VUhQ6zEky0o. My attempt, and the failure message:
$ youtube-dl --list-formats https://www.youtube.com/watch?v=VUhQ6zEky0o
[youtube] VUhQ6zEky0o: Downloading webpage
[youtube] VUhQ6zEky0o: Downloading video info webpage
ERROR: VUhQ6zEky0o: YouTube said: Invalid parameters.
Again, here's the error from above:
ERROR: VUhQ6zEky0o: YouTube said: Invalid parameters.
I tried youtube-dl with multiple live stream links while they were live. It didn't work for any of them. I got the error message above instead.
Solution
Use yt-dlp instead.
Last resort: use OBS studio to do a live screen capture
As a last resort, if you can't get youtube-dl nor yt-dlp to work, just do a live screen capture via OBS studio instead. Here are my detailed instructions on how to do that: Super User: How do you use OBS studio to perform screen capture (including to save live videos or make how-to tutorials)?.
This approach also works great, but is clearly not "downloading" the video stream in the same way.
As of 2023, youtube-dl seems to work fine, but note that sometimes the live stream separates the audio and video into distinct streams, then if you try to supply -f <preferred stream code> you will only get either the video or the audio.
The solution then is to simply not pass any argument, just youtube-dl https://address-to-the-stream.m3u8 and it will automatically download the best quality video stream and merge it transparently with the best audio stream via ffmpeg (tested on Windows 10).
I don't know squat about audio or the Terminal. I've use this Terminal command to convert a wav file for use in iOS:
afconvert -v -f 'caff' -d LEI16 -s 1 /users/myUserName/Desktop/hibeep.wav /users/myUserName/Desktop/hibeep.caf
After adding the file to my project, nothing happens when I execute:
NSURL * softURL = [[NSBundle mainBundle] URLForResource: #"hibeep" withExtension: #"caf"];
CFURLRef softSoundURL = (__bridge CFURLRef) softURL;
AudioServicesCreateSystemSoundID(softSoundURL, &_beepSound);
AudioServicesPlaySystemSound (_beepSound);
Yet, when I click on hibeep.caf in the Project Navigator, the sound will play fine.
I have tried this in both the simulator and on an iPad.
Any suggestions?
Thanks
TL;DR;
afconvert /System/Library/Sounds/Submarine.aiff ~/Desktop/sub.caf -d ima4 -f caff -v
Long version:
I know this is old, but this thread has solved my problem, so here's solution to the problem in the question.
CAF is only a container and you are using the wrong codec for the data held in the container. Quote from apple doc:
Custom alert sounds are played by the iOS system-sound facility, so they must be in one of the following audio data formats:
Linear PCM
MA4 (IMA/ADPCM)
µLaw
aLaw
Here's the proper terminal command when converting WAV to CAF (MA4)
afconvert /System/Library/Sounds/Submarine.aiff ~/Desktop/sub.caf -d ima4 -f caff -v
Try to select your audio file and check if the target is selected
I tried everything but push notifications doesn't seem to work with custom sound. Placed CAF in project root && /Library/Sounds/ && xCode -> /Resources It's been 2 days, i'm running out of ideas.
A strange thing is that when I select a sound file in xCode, there is a window showing properties of that file but codecs: --- doesn't seem to detect. I exported wav files from Adobe Premiere using the codecs Apple asks for. Tried to add those wav files to project but did not work, tried to convert those wav to caf put did not work either... sigh.
I want to set an environment variable that has space in it.
It is a path to a folder and the folder name is:
/home/mehrabib/my video
I edit .bashrc and add the following line to it:
export $VIDEO=/home/mehrabib/my\ video
and run these commands:
echo $VIDEO
cd $VIDEO
The result is:
/home/mehrabib/my video
/home/mehrabib/my :no such file or directory
I change it to
export $VIDEO=/home/mehrabib/my\\\ video
and run these commands:
echo $VIDEO
cd $VIDEO
The result is:
/home/mehrabib/my\ video
/home/mehrabib/my\ :no such file or directory
What should I do?
You should do
export VIDEO="/home/mehrabib/my video"
and to sum Dan's comments up also do
cd "$VIDEO"
which will expand to
cd "/home/mehrabib/my video"
again.
Personally, I've come to prefer the ${VIDEO} syntax.
You can also substitute special characters - use * as a wildcard to substitute for the space.
VIDEO="/home/mehrabib/m*o"
Try to quote VIDEO: cd "$VIDEO".