Dissappearing characters in youtube-dl, ffmpeg, and windows - windows

so what happens is that if the video title has a symbol that isn't supported by your current locale then ffmpeg won't be able to get to that file properly.
Here's one example
►2 HOURS BEST MELODIC DUBSTEP MIX APRIL 2013◄ ヽ( ≧ω≦)ノ
as you may or may not be able to see, lots of symbols from unicode.
The problem is that in cmd and ffmpeg, though cmd can see
►2 HOURS BEST MELODIC DUBSTEP MIX APRIL 2013◄ ヽ( ≧ω≦)ノ
ffmpeg only sees
2 HOURS DUBSTEP_DRUMSTEP MIX AUGUST 2013 ヽ(≧ω≦)ノ
This is the exact error message (i'm using youtube-dl)
[ffmpeg] Adding metadata to 'C:\Music\ToBeDone\2014-06-01\►2 HOURS DUBSTEP_DRUMSTEP MIX AUGUST 2013◄ ヽ( ≧ω≦)ノ.mp4'
ERROR: C:\Music\ToBeDone\2014-06-01\2 HOURS DUBSTEP_DRUMSTEP MIX AUGUST 2013 ヽ(≧ω≦)ノ.mp4: No such file or directory
ERROR: WARNING: unable to obtain file audio codec with ffprobe
After some research i've determined that by changing the system locale you can change which symbols cmd can support.
However
ヽ
Used to appear as a box in a question mark in United states locale. In japanese locale it appears as it does on your screen right now.
the problem with
◄
is that even though it's not appearing as a question mark in a box (it's appearing as how it should be), ffmpeg (or cmd) can't detect it properly.
(Refer back to the error message, i'll repost it below.)
[ffmpeg] Adding metadata to 'C:\Music\ToBeDone\2014-06-01\►2 HOURS DUBSTEP_DRUMSTEP MIX AUGUST 2013◄ ヽ( ≧ω≦)ノ.mp4'
ERROR: C:\Music\ToBeDone\2014-06-01\2 HOURS DUBSTEP_DRUMSTEP MIX AUGUST 2013 ヽ(≧ω≦)ノ.mp4: No such file or directory
ERROR: WARNING: unable to obtain file audio codec with ffprobe
So as you can see, I think cmd passed on the symbol correctly to ffmpeg seeing from the adding metadata line, but when it actually does the operation ffmpeg loses
► and ◄
Could this be a bug with ffmpeg? MY workaround so far with incompatible symbols was to change the system locale, but I don't think i can do that with these two symbols...
These are the unique characters that i need to have a locale that supports
Ö
◄ ヽ( ≧ω≦)ノ
( ͡° ͜ʖ ͡°)
(_≧∇≦)
†
【
More info on the problem in general
https://github.com/rg3/youtube-dl/issues/2999
and this is what's going on (Batch Script)
#echo off
setlocal
cd C:\youtube-dl
set /p "var1=Enter URL: " %=% pause
if defined var1 set "var1=%var1:"=%"
set "var2=%date:/=-%"
set "var3=%%(title)s.%%(ext)s"
youtube-dl "%var1%" -ci -o "C:\Music\ToBeDone\%var2%\%var3%" -f best -x --no-mtime --add-metadata
youtube-dl "%var1%" --skip-download -ci -o "C:\Music\ToBeDone\%var2%\Thumbnail\%var3%" --write- thumbnail
youtube-dl "%var1%" --skip-download -ci -o "C:\Music\ToBeDone\%var2%\Description\%var3%" --write-description

Related

Invalid data error during ffmpeg .m4a conversion

I wanted to edit my .m4a voice recording from Samsung Voice Recorder using ffmpeg 2.2.2, however, I got the error Invalid data found when processing input. I tried to open it through Audacity, but it returned an error claiming that the ffmpeg library is missing, which is definitely not the case. Eventually I tried to use online .m4a to .mp3 converters, but they all returned error, so I assume there may be an issue with the encoding of the original file and ffmpeg should be configured accordingly. What settings shall I use? (The original file can be played on the phone without any problem.)
ffmpeg -ss 00:00:19 -i "C:\Your\Folder\original.m4a" edited.m4a

Are these emojis valid UTF-8?

Problem
When present in media file metadata, the following emojis (and presumably many others as well) cause VLC to crash. This appears to be due to dbus message validation rejecting them as invalid UTF-8 sequences. However, the iconv utility accepts them. Are they invalid, or is dbus at fault here?
🔈 -> 0xf0 0x9f 0x94 0x88
🎧 -> 0xf0 0x9f 0x8e 0xa7
Details
On my system (Ubuntu 18.04), VLC crashes when attempting to play certain media files. Launching from the command line yields some information.
$ vlc problematic_file.webm
VLC media player 3.0.8 Vetinari (revision 3.0.8-0-gf350b6b5a7)
[0000557f93cb1570] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
dbus[3681]: arguments to dbus_message_iter_append_basic() were incorrect, assertion "_dbus_check_is_valid_utf8 (*string_p)" failed in file ../../../dbus/dbus-message.c line 2754.
This is normally a bug in some application using the D-Bus library.
D-Bus not built with -rdynamic so unable to print a backtrace
Aborted (core dumped)
Apparently I'm not the first person this has happened to. Using ffmpeg to strip out the global metadata resolved the crash.
$ ffmpeg -i problematic_file.webm -c copy -map_metadata -1 fixed.webm
Based on this, the obvious generalized solution seems to be to extract all metadata, validate it, sanitize it as necessary, and write it back. However, testing with the iconv utility indicated that the extracted (problematic) metadata was in fact valid UTF-8!
$ ffmpeg -i problematic_file.webm -f ffmetadata metadata.txt
$ iconv -f UTF-8 metadata.txt -o /dev/null; echo $?
0
Further testing indicated that the emojis identified above were the source of the problem.

cannot edit ghostprint ppd in Windows 10

I had some difficulty posing my problem in a way that the Title filter found pleasing. The real problem is that modifying only the GhostPDF.PDD file in the GS9.26 installation in Windows 10 doesn't seem to affect the output after a re-installation using Windows 10 Device Installer.
I print to a networked Sun SPARCprinter 1 which is controlled by Ghostprint (script?) compiled to run on SunOS 4.1.4. This has worked successfully for some years printing output from Windows XP using Adobe's PS driver and a SPARCstation PPD cobbled together from samples found on the net.
I've installed Artifex's 9.26 on Windows 10 and output to an LPR printer (The Sun). The output works, is recognized as PS output by the Sun, but produces a number of FATAL errors.
I need to edit the Windows Ghostscript installation to output PS files which are more suitable for the Sun.
So to my simple question: Do I need to modify anything in the Ghostscript Windows 10 installation other than the Ghostpdf.PPD file?
additional info:
SPARCstation 10 information:
SunOS 4.1.4
arcad# gcc -dumpversion
2.95.2 Note: I had to bootstrap this version up from the early GCC which could be compiled with the SunOS 4.1.4 C compiler. I had the impression I couldn't bring it up any further but could be mistaken.
arcad# gs --help
Aladdin Ghostscript 6.01 (2000-03-17)
Copyright (C) 2000 Aladdin Enterprises ...
Usage: gs [switches] [file1.ps file2.ps ...]
Most frequently used switches: (you can use # in place of =)
-dNOPAUSE no pause after page | -q `quiet', fewer messages
-g<width>x<height> page size in pixels | -r<res> pixels/inch resolution
-sDEVICE=<devname> select device | -dBATCH exit after last file
-sOutputFile=<file> select output file: - for stdout, |command for pipe,
embed %d or %ld for page #
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PDF
.....
For more information, see /usr/local/share/ghostscript/6.01/doc/Use.htm.
Note: I think this is the most recent GS version I can compile with this gcc version
printcap section:
gp|GhostPrinter:\
:lp=/dev/lpvi0:sd=/var/spool/gsprintspool:lf=/var/spool/gsprintspool/log:\
:mx#0:sh:if=/usr/local/libexec/lpfilter-gps:
Typical spool file - "....." indicates stuff not included here"
arcad# more dfA004DESKTOP-M8C5I86
%!PS-Adobe-3.0
%%Title: Document
%%Creator: PScript5.dll Version 5.2.2
%%CreationDate: 12/14/2018 19:56:8
%%For: jferg
%%BoundingBox: (atend)
%%Pages: (atend)
%%Orientation: Portrait
%%PageOrder: Special
%%DocumentNeededResources: (atend)
%%DocumentSuppliedResources: (atend)
%%DocumentData: Clean7Bit
%%TargetDevice: (Ghostscript) (3010) 815
%%LanguageLevel: 3
%%EndComments
%%BeginDefaults
%%PageBoundingBox: 0 0 612 792
%%ViewingOrientation: 1 0 0 1
%%EndDefaults
.....
%%EndResource
userdict /Pscript_WinNT_Incr 230 dict dup begin put
%%BeginResource: file Pscript_FatalError 5.0 0
userdict begin/FatalErrorIf{{initgraphics findfont 1 index 0 eq{exch pop}{dup
length dict begin{1 index/FID ne{def}{pop pop}ifelse}forall/Encoding
{ISOLatin1Encoding}stopped{StandardEncoding}if def currentdict end
/ErrFont-Latin1 exch definefont}ifelse exch scalefont setfont counttomark 3 div
cvi{moveto show}repeat showpage quit}{cleartomark}ifelse}bind def end
%%EndResource
userdict begin/PrtVMMsg{vmstatus exch sub exch pop gt{[
quires more memory than is available in this printer.)100 500
more of the following, and then print again:)100 485
put format, choose Optimize For Portability.)115 470
ce Settings page, make sure the Available PostScript Memory is accur--More--(2%)
ce the number of fonts in the document.)115 440
ocument in parts.)115 425 12/Times-Roman showpage
Error: Low Printer VM ]%%)= true FatalErrorIf}if}bind def end
2016 ge{/VM?{pop}bind def}{/VM? userdict/PrtVMMsg get def}ifelse
.....
SPARCprinter PDD file which works with Adobe PS in Windows XP:
john#hp2:~/sun-stuff/cups-sparc$ more SPARCprinter2.ppd
*PPD-Adobe: "4.1"
*% PostScript(R) Printer Description File for SPARCprinter
*% Date: 94/01/14
*% Copyright 1994 Sun Microsystems, Inc. All Rights Reserved.
*% Permission is granted for redistribution of this file as
*% long as this copyright notice is intact and the contents
*% of the file is not altered in any way from its original form.
*% End of Copyright statement
*% Changed margins on SPARCprinter JAF 3-3-2017
*FormatVersion: "4.1"
*FileVersion: "1.10"
*LanguageEncoding: ISOLatin1
*LanguageVersion: English
*PCFileName: "SPRN.PPD"
*Product: "(SPARCprinter)"
*PSVersion: "(3.000) 0"
*ModelName: "SPARCprinter"
*ShortNickName: "SPARCprinter"
*NickName: "SPARCprinter"
*% ==== Device Capabilities ===============
*LanguageLevel: "3"
*Extensions: CMYK Composite
*FreeVM: "4194304"
*ColorDevice: False
*DefaultColorSpace: Gray
*VariablePaperSize: False
*TTRasterizer: None
*FileSystem: False
..... more of the usual stuff
I don't really understand why you have installed Ghostscript on Windows. Windows is perfectly capable of producing PostScript files all of its own. In addition, the PPD file doesn't actually do very much, it is simply a text file with descriptions of the capabilities of the printer.
So the real problem is, or seems to be, that your SUN setup doesn't like the PostScript being produced by the new version of Windows.
You don't say how you are printing the PostScript file. not how your printer is 'controlled by Ghostscript' (I'm not aware of any product called Ghostprint, there is a GSPrint as part of GSView, but that's really for Windows).
Assuming you are using Ghostscript on your Sparc workstation to drive the pritner, then the most likely problem I would say is that you are using an old version of Ghostscript on the workstation, and it doesn't like the PostScript being generated by the newer version of Windows.
If you had included the transcript from the workstation Ghostscript installation it might be possible to say more but without that I'm rather guessing.
Another possibility is that you are using the ps2write device in Ghostscript to produce PostScript files on Windows. I can't think why you would be doing that, but it sort of fits your description. In that case editing the PPD file will have no effect, because Ghostscript doesn't use it.
Now the ps2write device emits level 2 PostScript, the clue is in the name, and its possible again that your Sparc setup is so elderly that it doesn't understand level 2, or doesn't fully implement it. In which case you will probably get errors. Again, if you were to provide the text of the error messages this would help!
In the latter case, you are frankly out of luck. We dropped support for level 1 PostScript output some time ago, what with level 2 being 28 years old now and level 3 coming up on 20. If you need language level 1 output you will have to go back to a very old version of Ghostscript. Something like 9.07 (from 5 and a half years ago) was the last version that included the pswrite device.
With effort you could take the pswrite device and upgrade it so that it works with the current version of Ghostscript
[EDIT]
My word, that's a really old version of Ghostscript!
You could try building a new version to replace it, but I also don't know if current code will compile on gcc 2.95. It 'should' because we only expect C89, but the third party libraries (which are essential) may very well not compile.
The PostScript file you quoted has been produced by Windows, not by Ghostscript (%%Creator: PScript5.dll Version 5.2.2). So it seems likely to me that your problem is the PostScript being produced by the newer version of Windows doesn't work with your 18 year old version of Ghostscript. That's not actually entirely surprising.
If you look at the DSC comments it says:
%%LanguageLevel: 3
And your Ghostscript information says that it supports language levels 1 and 2. At the time the level 3 spec had only just been published (1999), and clearly the maintainers back then hadn't had time to fully implement it.
Note that the ghostpdf.ppd file is intended for use with Ghostscript as a 'print to PDF' printer along with the RedMon port monitor.
Now its not obvious to me which PPD file you are using, but..... Both the ghostpdf.ppd file and the sparcprinter ppd file have :
*LanguageLevel: "3"
That tells the PostScript driver that it can use language level 3, which your Sparc Ghostscript doesn't support. You could try changing that to:
*LanguageLevel: "2"
and see if that makes a difference (you will have to uninstall the printers from Windows and re-install them with the modified PPD file).
If it doesn't work, the only other thing I can think of is to use the Ghostscript you installed on the Windows system, and preprocess the PostScript file produced by Windows before you send it on. You can use the ps2write device in Ghostscript 9.26 to take in the level 3 file, and produce a level 2 file. It might be a bit bigger, but it ought to work.
To do that on Windows you would use something like:
gswin64c -sDEVICE=ps2write -sOutputFile=out.ps <input.ps>
The file 'out.ps' should then be a level 2 PostScript file. I can't guarantee that the output will then work the old version of Ghostscript on your Sparc, but you stand a chance!

Writing metadata (Artist Name, Song Title, Year, Album, Duration, Genre) to mp3/m4a audio file using youtube-dl (subsequent AtomicParsely error)

I am extracting audio only from youtube videos using youtube-dl. I would like to write the metadata (i.e. Artist Name and Song Title, Year, Album, Duration, Genre) into the mp3/m4a file after downloading. My attempt to accomplish this starts with this code:
#echo off
youtube-dl --format m4a/mp3 --youtube-skip-dash-manifest --embed-thumbnail -o "%%(title)s.%%(ext)s" --metadata-from-title "%%(artist)s - %%(title)s" --add-metadata 2Y6Nne8RvaA
pause
This code produces the following output:
[youtube] 2Y6Nne8RvaA: Downloading webpage
[youtube] 2Y6Nne8RvaA: Extracting video information
[youtube] 2Y6Nne8RvaA: Downloading thumbnail ...
[youtube] 2Y6Nne8RvaA: Writing thumbnail to: Kungs vs Cookin' on 3 Burners - Thi
s Girl.jpg
[download] Destination: Kungs vs Cookin' on 3 Burners - This Girl.m4a
[download] 100% of 2.99MiB in 00:01
[ffmpeg] Correcting container in "Kungs vs Cookin' on 3 Burners - This Girl.m4a"
[fromtitle] parsed title: This Girl
[fromtitle] parsed artist: Kungs vs Cookin' on 3 Burners
[ffmpeg] Adding metadata to 'Kungs vs Cookin' on 3 Burners - This Girl.m4a'
ERROR: AtomicParsley was not found. Please install.
Press any key to continue . . .
As you can see, I am able to successfully able to add a few of the tags from the video, but not all of them and the Year is royally screwed up.
What is this AtomicParsely error and how do I remedy it? Do I need this program to correctly add all the Metadata to the file that I want, or can this be accomplished in another way?
Referencing Steven Penny's post, FFmpeg metadata not showing in Windows?, is solving this problem as simple as using an ffmpeg command?
When I do a google search for this song, the first link that shows is the exact link I'm using on YouTube, and the search shows pertinent metadata (see below). I'm not sure if this data is input manually by users, or if Google mined this from the video:
I admit that I'm new to using youtube-dl and ffmpeg, but with the help of the commenters on StackOverflow, I'm learning more each day. This post is a follow-up to my previous question: Downloading YouTube to mp3 and writing metadata (artist/song title) to mp3 file using youtube-dl
You are trying to use YouTube-DL, and in turn AtomicParsley to set the tags of
this file.
To use --embed-thumbnail, YouTube-DL must call an external program, as doing
that is beyond the scope of the YouTube-DL project. In this case they are
calling AtomicParsley.
Proper embedding thumbnails into M4A/MP4 is not easy, even in 2016. Several
tools can do this, but they each have their problems:
TagEditor is probably best suited to this task. It can do in place
editing assuming the file has enough padding. It does have an issue with
non ASCII content however.
MP4Box, Bento4 and AtomicParsley can all do this as well, but none of
them do in place editing. This can be a problem with larger files. In addition
AtomicParsley is starting to show its age.
Picard is also quite useful if you do not mind a GUI.
FFmpeg is a huge project and can’t do this at all.
Regarding the year: in this case YouTube-DL cannot help you, because that
information is not in the page:
$ de=$(mktemp)
$ wget -O "$de" https://www.youtube.com/watch?v=2Y6Nne8RvaA
$ grep '2009[^[:digit:]]' "$de" | wc
0 0 0
It is up to the uploader what they put in the description, and in what format.

FFMPEG not able to extract thumbnails of images larger than .6 MB

ffmpeg.exe -i "imageLarge.jpg" -y -f mjpeg -s 72x92 -vframes 1 -an thumbnail7292.jpg
We are using this command to generate thumbnails of image files using FFmpeg but found that it is not able to generate thumbnails of files larger than .6 MB can somebody suggest something on this.
It isn't clear what exactly the problem with ffmpeg is, but in any case I'd recommend using the convert utility from imagemagick. It's much simpler:
convert imageLarge.jpg -resize 72x92 thumbnail7292.jpg
If you give a description of the actual error, then more people will be able to help you.
EDIT
The OP's error is:
swScaler: Compile time max width is 2048
change VOF/VOFW and recompile
Cannot get resampling context
It's quite clear what the problem is. Your JPEG files are too big for your current build of ffmpeg. You will have to recompile ffmpeg or get a newer version if you want to work with larger images.
This is from src/libswscale/swscale_internal.h (version: FFmpeg SVN-r26402).
#if ARCH_X86
#define VOFW 5120
#else
#define VOFW 2048 // faster on PPC and not tested on others
#endif
That's the file you need to edit if you want to change the limits.
What version of ffmpeg are you using? This problem seems to have been addressed over a year ago.
If you don't want to rebuild ffmpeg, you could just use convert, like I originally advised.

Resources