GithubHelp home page GithubHelp logo

wez / atomicparsley Goto Github PK

View Code? Open in Web Editor NEW
521.0 14.0 64.0 3.76 MB

AtomicParsley is a lightweight command line program for reading, parsing and setting metadata into MPEG-4 files, in particular, iTunes-style metadata.

Home Page: https://github.com/wez/atomicparsley

License: GNU General Public License v2.0

C 9.63% C++ 87.80% Objective-C++ 1.75% Perl 0.58% CMake 0.21% Shell 0.02%

atomicparsley's Introduction

AtomicParsley

GitHub Workflow Status

AtomicParsley is a lightweight command line program for reading, parsing and setting metadata into MPEG-4 files, in particular, iTunes-style metadata.

Install

macOS

  • Navigate to the latest release
  • Download the AtomicParsleyMacOS.zip file and extract AtomicParsley

AtomicParsley is also available for brew users and can be installed by executing this command in a terminal:

$ brew install atomicparsley

Note that the version available in brew may lag behind the latest version of the code in this repo.

Windows

  • Navigate to the latest release
  • Download the AtomicParsleyWindows.zip file and extract AtomicParsley.exe

Linux (x86-64)

  • Navigate to the latest release
  • Download the AtomicParsleyLinux.zip file and extract AtomicParsley

Alpine Linux (x86-64 musl libc)

  • Navigate to the latest release
  • Download the AtomicParsleyAlpine.zip file and extract AtomicParsley
  • And finally apk add libstdc++

Usage

AtomicParsley sets metadata into MPEG-4 files & derivatives supporting 3 tag
 schemes: iTunes-style, 3GPP assets & ISO defined copyright notifications.

AtomicParsley quick help for setting iTunes-style metadata into MPEG-4 files.

General usage examples:
  AtomicParsley /path/to.mp4 -T 1
  AtomicParsley /path/to.mp4 -t +
  AtomicParsley /path/to.mp4 --artist "Me" --artwork /path/to/art.jpg
  Atomicparsley /path/to.mp4 --albumArtist "You" --podcastFlag true
  Atomicparsley /path/to.mp4 --stik "TV Show" --advisory explicit

Getting information about the file & tags:
  -T  --test        Test file for mpeg4-ishness & print atom tree
  -t  --textdata    Prints tags embedded within the file
  -E  --extractPix  Extracts pix to the same folder as the mpeg-4 file

Setting iTunes-style metadata tags
  --artist       (string)     Set the artist tag
  --title        (string)     Set the title tag
  --album        (string)     Set the album tag
  --genre        (string)     Genre tag (see --longhelp for more info)
  --tracknum     (num)[/tot]  Track number (or track number/total tracks)
  --disk         (num)[/tot]  Disk number (or disk number/total disks)
  --comment      (string)     Set the comment tag
  --year         (num|UTC)    Year tag (see --longhelp for "Release Date")
  --lyrics       (string)     Set lyrics (not subject to 256 byte limit)
  --lyricsFile   (/path)      Set lyrics to the content of a file
  --composer     (string)     Set the composer tag
  --copyright    (string)     Set the copyright tag
  --grouping     (string)     Set the grouping tag
  --artwork      (/path)      Set a piece of artwork (jpeg or png only)
  --bpm          (number)     Set the tempo/bpm
  --albumArtist  (string)     Set the album artist tag
  --compilation  (boolean)    Set the compilation flag (true or false)
  --hdvideo      (number)     Set the hdvideo flag to one of:
                              false or 0 for standard definition
                              true or 1 for 720p
                              2 for 1080p
  --advisory     (string*)    Content advisory (*values: 'clean', 'explicit')
  --stik         (string*)    Sets the iTunes "stik" atom (see --longhelp)
  --description  (string)     Set the description tag
  --longdesc     (string)     Set the long description tag
  --storedesc    (string)     Set the store description tag
  --TVNetwork    (string)     Set the TV Network name
  --TVShowName   (string)     Set the TV Show name
  --TVEpisode    (string)     Set the TV episode/production code
  --TVSeasonNum  (number)     Set the TV Season number
  --TVEpisodeNum (number)     Set the TV Episode number
  --podcastFlag  (boolean)    Set the podcast flag (true or false)
  --category     (string)     Sets the podcast category
  --keyword      (string)     Sets the podcast keyword
  --podcastURL   (URL)        Set the podcast feed URL
  --podcastGUID  (URL)        Set the episode's URL tag
  --purchaseDate (UTC)        Set time of purchase
  --encodingTool (string)     Set the name of the encoder
  --encodedBy    (string)     Set the name of the Person/company who encoded the file
  --apID         (string)     Set the Account Name
  --cnID         (number)     Set the iTunes Catalog ID (see --longhelp)
  --geID         (number)     Set the iTunes Genre ID (see --longhelp)
  --xID          (string)     Set the vendor-supplied iTunes xID (see --longhelp)
  --gapless      (boolean)    Set the gapless playback flag
  --contentRating (string*)   Set tv/mpaa rating (see -rDNS-help)

Deleting tags
  Set the value to "":        --artist "" --stik "" --bpm ""
  To delete (all) artwork:    --artwork REMOVE_ALL
  manually removal:           --manualAtomRemove "moov.udta.meta.ilst.ATOM"

More detailed iTunes help is available with AtomicParsley --longhelp
Setting reverse DNS forms for iTunes files: see --reverseDNS-help
Setting 3gp assets into 3GPP & derivative files: see --3gp-help
Setting copyright notices for all files: see --ISO-help
For file-level options & padding info: see --file-help
Setting custom private tag extensions: see --uuid-help
Setting ID3 tags onto mpeg-4 files: see --ID3-help

----------------------------------------------------------------------
AtomicParsley version: 20221229.172126.0 d813aa6e0304ed3ab6d92f1ae96cd52b586181ec (utf8)

Submit bug fixes to https://github.com/wez/atomicparsley

Build from Source

If you are building from source you will need cmake and make. On Windows systems you'll need Visual Studio or MingW.

cmake .
cmake --build . --config Release

will generate an AtomicParsley executable.

Dependencies:

zlib - used to compress ID3 frames & expand already compressed frames available from http://www.zlib.net

A note on maintenance!

I made some fixes to the original project on sourceforge back in 2009 and became the de-facto fork of AtomicParsley as a result. However, I haven't used this tool myself in many years and have acted in a very loose guiding role since then.

In 2020 Bitbucket decided to cease hosting Mercurial based repositories which meant that I had to move it in order to keep it alive, so you'll see a flurry of recent activity.

I'll consider merging pull requests if they are easy to review, but because I don't use this tool myself I have no way to verify complex changes. If you'd like to make such a change, please consider contributing some kind of basic automated test with a corresponding small test file.

This repo has GitHub Actions enabled for the three major platforms so bootstrapping some test coverage is feasible.

You are welcome to report issues using the issue tracker, but I (@wez) am unlikely to act upon them.

atomicparsley's People

Contributors

abs0 avatar arter97 avatar astiob avatar aunicornwithnolife avatar coolaj86 avatar dinkypumpkin avatar holyroses avatar howyallare avatar ihsinme avatar jnahmias avatar jon-hedgerows avatar julianaito avatar lovek323 avatar luken avatar miraclx avatar schuellerstefan avatar sebma avatar vrza avatar wez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

atomicparsley's Issues

A stack-buffer-overflow occurs while parsing movie details

System Configuration

  • AtomicParsley version: atomicparsley 020176f
  • Used arguments: -T 1 -t +
  • Environment (Operating system, version and so on): Ubuntu 20.04.2 64bit
  • Additional information: compilation with asan

Description
Buffer overflow occurs while 64-bit fread(util.cpp/APar_read64() 299line) because the size of the buffer(extracts.cpp/APar_ExtractDetails() 1591line) is small (5 bytes)

==53286==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffffffd8c5 at pc 0x7ffff75e858d bp 0x7fffffffd5d0 sp 0x7fffffffcd78
WRITE of size 8 at 0x7fffffffd8c5 thread T0
#0 0x7ffff75e858c (/lib/x86_64-linux-gnu/libasan.so.5+0x6b58c)
#1 0x5555555fd468 in fread /usr/include/x86_64-linux-gnu/bits/stdio2.h:297
#2 0x5555555fd468 in APar_read64(char*, _IO_FILE*, unsigned long) /home/ubuntu/tmp/atomicparsley/src/util.cpp:299
#3 0x5555555a05a0 in APar_ExtractTrackDetails(char*, _IO_FILE*, Trackage*, TrackInfo*) /home/ubuntu/tmp/atomicparsley/src/extracts.cpp:1247
#4 0x5555555a2883 in APar_ExtractDetails(_IO_FILE*, unsigned char) /home/ubuntu/tmp/atomicparsley/src/extracts.cpp:1635
#5 0x5555555c07e7 in real_main(int, char**) /home/ubuntu/tmp/atomicparsley/src/main.cpp:1637
#6 0x7ffff70650b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
#7 0x55555559921d in _start (/home/ubuntu/tmp/atomicparsley/AtomicParsley+0x4521d)

Address 0x7fffffffd8c5 is located in stack of thread T0 at offset 453 in frame
#0 0x5555555a23df in APar_ExtractDetails(_IO_FILE*, unsigned char) /home/ubuntu/tmp/atomicparsley/src/extracts.cpp:1590

This frame has 3 object(s):
[32, 36) 'track' (line 1592)
[48, 384) 'track_info' (line 1632)
[448, 453) 'uint32_buffer' (line 1591) <== Memory access at offset 453 overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
(longjmp and C++ exceptions are supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow (/lib/x86_64-linux-gnu/libasan.so.5+0x6b58c)
Shadow bytes around the buggy address:
0x10007fff7ac0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10007fff7ad0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10007fff7ae0: f1 f1 f1 f1 04 f2 00 00 00 00 00 00 00 00 00 00
0x10007fff7af0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10007fff7b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x10007fff7b10: f2 f2 f2 f2 f2 f2 f2 f2[05]f3 f3 f3 00 00 00 00
0x10007fff7b20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10007fff7b30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10007fff7b40: f1 f1 f1 f1 f1 f1 01 f2 01 f2 01 f2 01 f2 01 f2
0x10007fff7b50: 01 f2 01 f2 01 f2 01 f2 01 f2 01 f2 01 f2 01 f2
0x10007fff7b60: 01 f2 01 f2 01 f2 01 f2 01 f2 01 f2 01 f2 01 f2
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==53286==ABORTING

I've attached the file. Please download and check the file.
2021-05-04-09_21_45_0xf6b390a1_0xb1c1261c.zip

WEBP support

Hi there. Not sure if you're aware, but a lot of your users (from YouTubeDL) are unable to use your tool to embed thumbnails into videos.

YouTube is actually switching to WEBP for thumbnails now, which is causing atomicparsley to not convert. I was wondering if you would be so kind as to add .webp support to your tool.

Thank you

Cannot build atomicparsley on Ubuntu 18.04 LTS : cmake install TARGETS given no RUNTIME DESTINATION for executable target

Hi,

I cannot build atomicparsley on Ubuntu 18.04 LTS :

CMake Error at CMakeLists.txt:104 (install):
  install TARGETS given no RUNTIME DESTINATION for executable target
  "AtomicParsley".


-- Configuring incomplete, errors occurred!
See also "/home/sebastien/git/wez/atomicparsley/CMakeFiles/CMakeOutput.log".

The solution is here ๐Ÿ˜„ :

$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 136ed42..72b8f3c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.16)
+cmake_minimum_required(VERSION 3.10)
 project(AtomicParsley)
 
 if(NOT CMAKE_BUILD_TYPE)
@@ -100,4 +100,4 @@ if (ASAN)
   set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
 endif()
 
-install(TARGETS AtomicParsley RUNTIME)
+install(TARGETS AtomicParsley RUNTIME DESTINATION bin)

I'll be creating a PR in a moment ...

No Linux releases

README says to download AtomicParsleyLinux.zip, but there is no such file.

mp4 file with extra tags results in incorrect output from AtomicParsley

Looks like if a non standard tag is added by, for example, ffmpeg, AtomicParsley reports on all of the tokes, but called them the empty string. If the example below I've removed the extraneous ffprobe output:

$ AtomicParsley file.mp4 -t
Atom "ยฉnam" contains: Title
Atom "ยฉtoo" contains: Lavf58.20.100
Atom "ยฉcmt" contains: Comment
Atom "ยฉday" contains: 2023
Atom "desc" contains: Description
$ ffprobe -i file.mp4 -print_format json -show_format
 < deleted >
    "format": {
        "filename": "file.mp4",
        "nb_streams": 2,
        "nb_programs": 0,
        "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
        "format_long_name": "QuickTime / MOV",
        "start_time": "0.000000",
        "duration": "2100.235000",
        "size": "362797503",
        "bit_rate": "1381931",
        "probe_score": 100,
        "tags": {
            "major_brand": "isom",
            "minor_version": "512",
            "compatible_brands": "isomiso2avc1mp41",
            "creation_time": "2023-04-03T03:06:47.000000Z",
            "title": "Title",
            "encoder": "Lavf58.20.100",
            "comment": "Comment",
            "date": "2023",
            "description": "Description"
        }
    }

Now add an extra tag to the file and re-run AtomicParsley and ffprobe again

$ ffmpeg -i file.mp4 -movflags use_metadata_tags -metadata newTag="newTag" -c copy file2.mp4 >/dev/null 2>&1
$ AtomicParsley file2.mp4 -t
Atom "" contains: isom
Atom "" contains: 512
Atom "" contains: isomiso2avc1mp41
Atom "" contains: Description
Atom "" contains: Title
Atom "" contains: newTag
Atom "" contains: Comment
Atom "" contains: 2023
Atom "" contains: Lavf59.27.100
$ ffprobe -i file2.mp4 -print_format json -show_format
 < deleted >
    "format": {
        "filename": "file2.mp4",
        "nb_streams": 2,
        "nb_programs": 0,
        "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
        "format_long_name": "QuickTime / MOV",
        "start_time": "0.000000",
        "duration": "2100.199000",
        "size": "362797671",
        "bit_rate": "1381955",
        "probe_score": 100,
        "tags": {
            "minor_version": "512",
            "major_brand": "isom",
            "compatible_brands": "isomiso2avc1mp41",
            "description": "Description",
            "title": "Title",
            "newTag": "newTag",
            "comment": "Comment",
            "date": "2023",
            "encoder": "Lavf59.27.100"
        }
    }

windows 32-bit binary, please?

Humongous thanks for bringing this project out of stagnation! ๐Ÿ‘
I was extremely excited to see that you are now also providing yourself Windows binaries ๐Ÿฅ‡

... Imagine how let down I ended up feeling when I discovered that your offered executable AtomicParsley.exe is only 64-bit!

AP

I am fully aware that 64-bit is today's norm, but not all of us Windows users are on that architecture yet... ๐Ÿ˜ž Especially people like me on older hardware with limited RAM (Win7 SP1 32-bit with 3GB RAM); would it be much asking for a win32 executable along the already provided win64 one?

Many thanks in advance, keep up the sterling efforts!

PS: I know self-compilation is always an option, but installing/configuring/running a compilation toolchain (MSYS2/MinGW I believe is being currently offered as 64-bit, only...) on low-end hardware (with a 32-bit OS) defeats the purpose...

Add support to read from stream

I would like to use something like:

AtomicParsley - -T< add_10sec.mp4

or

cat add_10sec.mp4 | AtomicParsley - -T

I need to check only if the file has moov in the beginning of the file, so parse two atoms, and if it's there or not and close the file, so would not need to parse whole big mp4 file to detect if moov is in the beginning of the file.

so, I thought I feed AtomicParsley data until it prints out two first atoms and close the pipe.

Alpine Linux: Error loading shared library libstdc++.so.6

Using the Alpine release in a bare Alpine installation (such as a docker instance), this error pops up

Error loading shared library libstdc++.so.6: No such file or directory (needed by ./AtomicParsley)
Error relocating ./AtomicParsley: __cxa_guard_release: symbol not found
Error relocating ./AtomicParsley: __cxa_guard_acquire: symbol not found

Steps to reproduce

wget https://github.com/miraclx/atomicparsley/releases/download/20_test_alpine_release/AtomicParsleyAlpine.zip
unzip AtomicParsleyAlpine.zip AtomicParsley
docker run -it --rm -v $PWD:/mnt -w /mnt alpine ./AtomicParsley

Como posso obter o token do Apple music??

[โ€ข] Identifying service...[Apple Music]
[โ€ข] Checking authentication...[authenticated]
Detected [album]
Obtaining album metadata...(failed: [Unexpected end of JSON input])
[i] An error occurred while processing the query
========== Stats ==========
[โ€ข] Runtime: [788ms] [โ€ข] Total queries: [01]
[โ€ข] Total tracks: [00]
ยป Skipped: [00]
โœ“ Passed: [00]
โœ• Failed: [00]
[โ€ข] Output directory: [.]
[โ€ข] Cover Art: cover.png (640x640)
[โ€ข] Total Output size: 0.00 B [โ€ข] Total Network Usage: 0.00 B
โ™ซ Media: 0.00 B
โžค Album Art: 0.00 B
[โ€ข] Output bitrate: 320k

error: filename/filepath was too long

Hey,

Just come up against one I haven't seen before.
AtomicParsley error: filename/filepath was too long.
Bit of a pain really. Was is the character length set to?

Unable to write to a directory lacking write permission.

I use AtomicParsley with kmttg on a Win10 box and save processed MP4 video files to a Synology NAS.

Several months ago I noticed that random AP jobs never completed. The original MP4 file was correctly renamed as a temp file and apparently metadata was inserted. But the final name change back to a normal MP4 file never happened (i.e., AP hung indefinitely). The error log showed:

Finished writing to temp file.
Unable to write to a directory lacking write permission.

"Both" files are in the same NAS directory.

Furthermore, If I kill the hung AP instances and AP later runs to completion any leftover temp files (which are probably OK except for the filename) get deleted (cleanup action).

Any ideas would be appreciated. Thanks

Stuck on Progress 0%

I am using atomicparsley on a manjaro linux vm. Installed the latest release from pacman. whenever I try to add even an art work it just stops at Progress 0%. Is there any way to output an error? When doing this command: "atomicparsley test.mp4 --artwork test.jpg -o test.temp.mp4" it creates the output file but then does nothing. I believe it has to do with permissions as this only happens in my shared drive from virtualbox.

Carriage returns stripped from --lyricsFile

Adding a lyrics tag using --lyricsFile strips all the carriage returns. A hexedit shows that all the 0A bytes have been stripped.

The only way I can get them in is using --lyrics with the text in quotation marks in which case any other quotation marks in the tag have to be escaped.

No version information from binary

There is no reported version information beyond (utf8) which isn't' exactly saying anything

$ AtomicParsley --version
AtomicParsley version:   (utf8)

rDNS is broken in latest Windows release (only tested with binaries)

rDNS tagging seems to be broken in latest Windows release. Starting with a blank input file or wiping any existing metadata in it before writing rDNS does not make a difference, and neither does writing in place or to temp output.

For example:

AtomicParsley.exe Test.m4a --preserveTime --metaEnema

AtomicParsley.exe Test.m4a --preserveTime --rDNSatom " 00001BAB 00001CB3 000093C6 00009D77 0001145F 0001E1B9 00007C14 00007A19 000188D6 0001BB5B" name=iTunNORM domain=com.apple.iTunes

writes metadata to iTun "atom" on domain com.apple.iTunes

Testing with AtomicParsley.exe Test.m4a -t yields:

Atom "----" [com.apple.iTunes;iTun] contains: 00001BAB 00001CB3 000093C6 00009D77 0001145F 0001E1B9 00007C14 00007A19 000188D6 0001BB5B

Some quick tests show that anything beyond the first 4 chars of the atom name are being truncated. Even worse, repeating the process ends up with multiple iTun "atoms".

EDIT 1: Running Windows 64-bit, tested with both AP 32 and 64. Same issue.

EDIT 2: I can confirm that this regression seems to have been introduced with the 2022 release. The 20210715.151551.e7ad03a release works as expected.

Still buffer overflows with rDNS tags

Using ASAN options, I tried to fix buffer overflows with rDNS tags.

Navigating through the original source code is not easy and even if I did not find where the actual overflow happens, I think the proposed workaround would/could be acceptable.
Adding 4 more bytes than normally necessary when allocating memory storing rDNS name seems to bypass the problem.
So maybe someone would be interested in testing this in another context or even finding a better solution.

Here comes a potential patch to solve the problem.
reverseDNS.patch

image

Here comes a sample .sh script that adds many rDNS tags to a .m4a file converted from a .flac file.
try.sh.zip

image

Here comes the ASAN report without the patch.
asan.txt

Version Number is not reported when installed via `brew`

I have updated AtomicParsley via homebrew atomicparsley 20200701.154658.b0d6223.

When I run command AtomicParsley without and parameters the version string reported is:
AtomicParsley version: (utf8)

Any more script that was using this cannot read the version number to validate. I was expecting some pattern like 0.9.6 to read.

20210715.151551.e7ad03a: -Wstringop-overflow compile time warnings

gcc 11.1.1

/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/main.cpp: In function 'int real_main(int, char**)':
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/main.cpp:3800:26: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context]
 3800 |             sizeof(char) * set_UTF16_text
      |             ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/parsley.cpp: In function 'void APar_freefree(int)':
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/parsley.cpp:2188:9: warning: variable 'prev_atom' set but not used [-Wunused-but-set-variable]
 2188 |   short prev_atom = 0;
      |         ^~~~~~~~~
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/parsley.cpp: In function 'uint64_t APar_QuickSumAtomicLengths(AtomicInfo*)':
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/parsley.cpp:4041:9: warning: variable 'current_level' set but not used [-Wunused-but-set-variable]
 4041 |   short current_level = 0;
      |         ^~~~~~~~~~~~~
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/parsley.cpp: In function 'bool APar_Readjust_iloc_atom(short int)':
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/parsley.cpp:4188:18: warning: variable 'this_extent_offset' set but not used [-Wunused-but-set-variable]
 4188 |         uint64_t this_extent_offset = 0;
      |                  ^~~~~~~~~~~~~~~~~~
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/parsley.cpp: In function 'void APar_DetermineAtomLengths()':
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/parsley.cpp:5186:11: warning: variable 'previous_atom' set but not used [-Wunused-but-set-variable]
 5186 |     short previous_atom = 0; // only gets used in testing for atom under stsd
      |           ^~~~~~~~~~~~~
In function 'APar_UnpackLanguage',
    inlined from 'APar_Print_single_userdata_atomcontents' at /home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:1158:24:
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/util.cpp:394:16: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  394 |   lang_code[3] = 0;
      |                ^
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp: In function 'APar_Print_single_userdata_atomcontents':
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:981:17: note: at offset 3 into destination object 'unpacked_lang' of size 3
  981 |   unsigned char unpacked_lang[3];
      |                 ^
In function 'APar_UnpackLanguage',
    inlined from 'APar_Print_single_userdata_atomcontents' at /home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:1058:24:
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/util.cpp:394:16: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  394 |   lang_code[3] = 0;
      |                ^
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp: In function 'APar_Print_single_userdata_atomcontents':
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:981:17: note: at offset 3 into destination object 'unpacked_lang' of size 3
  981 |   unsigned char unpacked_lang[3];
      |                 ^
In function 'APar_UnpackLanguage',
    inlined from 'APar_Print_single_userdata_atomcontents' at /home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:1110:24:
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/util.cpp:394:16: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  394 |   lang_code[3] = 0;
      |                ^
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp: In function 'APar_Print_single_userdata_atomcontents':
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:981:17: note: at offset 3 into destination object 'unpacked_lang' of size 3
  981 |   unsigned char unpacked_lang[3];
      |                 ^
In function 'APar_UnpackLanguage',
    inlined from 'APar_Print_single_userdata_atomcontents' at /home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:1090:24:
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/util.cpp:394:16: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  394 |   lang_code[3] = 0;
      |                ^
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp: In function 'APar_Print_single_userdata_atomcontents':
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:981:17: note: at offset 3 into destination object 'unpacked_lang' of size 3
  981 |   unsigned char unpacked_lang[3];
      |                 ^
In function 'APar_UnpackLanguage',
    inlined from 'APar_Print_single_userdata_atomcontents' at /home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:1002:24:
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/util.cpp:394:16: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  394 |   lang_code[3] = 0;
      |                ^
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp: In function 'APar_Print_single_userdata_atomcontents':
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:981:17: note: at offset 3 into destination object 'unpacked_lang' of size 3
  981 |   unsigned char unpacked_lang[3];
      |                 ^
In function 'APar_UnpackLanguage',
    inlined from 'APar_Print_ID3v2_tags' at /home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:1412:22,
    inlined from 'APar_Print_metachild_atomcontents' at /home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:1760:26,
    inlined from '_Z22APar_PrintMetaChildrenP10AtomicInfoS0_b.part.0.isra' at /home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:1774:44:
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/util.cpp:394:16: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  394 |   lang_code[3] = 0;
      |                ^
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp: In function '_Z22APar_PrintMetaChildrenP10AtomicInfoS0_b.part.0.isra':
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:1411:17: note: at offset 3 into destination object 'unpacked_lang' of size 3
 1411 |   unsigned char unpacked_lang[3];
      |                 ^
In function 'APar_UnpackLanguage',
    inlined from 'APar_PrintAtomicTree' at /home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:2015:26,
    inlined from 'real_main' at /home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/main.cpp:1631:27:
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/util.cpp:394:16: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  394 |   lang_code[3] = 0;
      |                ^
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/main.cpp: In function 'real_main':
/home/tkloczko/rpmbuild/BUILD/atomicparsley-20210715.151551.e7ad03a/src/metalist.cpp:2014:21: note: at offset 3 into destination object 'unpacked_lang' of size 3
 2014 |       unsigned char unpacked_lang[3];
      |                     ^

20210124.204813.840499f: install target do not install anything

[tkloczko@barrel atomicparsley-20210124.204813.840499f]$ DESTDIR=/home/tkloczko/rpmbuild/BUILDROOT/atomicparsley-20210124.204813.840499f-17.fc35.x86_64 /usr/bin/cmake --install x86_64-redhat-linux-gnu --verbose
-- Install configuration: "RelWithDebInfo"
[tkloczko@barrel atomicparsley-20210124.204813.840499f]$

A stack-buffer-overflow occurs while parsing a file

System Configuration

  • AtomicParsley version: atomicparsley-20210124.204813.840499f
  • Used arguments: -T 1 -t +
  • Environment (Operating system, version and so on): Ubuntu 20.04.2 64bit
  • Additional information: compilation with asan

==34075==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffffffd800 at pc 0x7ffff75e858d bp 0x7fffffffd540 sp 0x7fffffffcce8
WRITE of size 3936 at 0x7fffffffd800 thread T0

Program received signal SIGSEGV, Segmentation fault.

#0 0x00007ffff6ffcc50 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#1 0x00007ffff6ffe77b in _Unwind_Backtrace () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#2 0x00007ffff76b4a28 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
#3 0x00007ffff75af7f7 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
#4 0x00007ffff76949ed in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
#5 0x00007ffff7694363 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
#6 0x00007ffff75e85af in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
#7 0x00005555555fd597 in fread (__stream=0x615000000580, __n=0x203c, __size=0x1, __ptr=0x7fffffffd6cd)
at /usr/include/x86_64-linux-gnu/bits/stdio2.h:297
#8 APar_readX (buffer=0x7fffffffd6cd "", ISObasemediafile=ISObasemediafile@entry=0x615000000580,
pos=, length=0x203c) at /home/ubuntu/tmp/atomicparsley-20210124.204813.840499f/src/util.cpp:330
#9 0x00005555555a02d0 in APar_ExtractTrackDetails (uint32_buffer=uint32_buffer@entry=0x602000000050 "",
isofile=isofile@entry=0x615000000580, track=track@entry=0x7fffffffd6a0,
track_info=track_info@entry=0x7fffffffd6b0)
at /home/ubuntu/tmp/atomicparsley-20210124.204813.840499f/src/extracts.cpp:1286
#10 0x00005555555a243b in APar_ExtractDetails (isofile=, optional_output=)
at /home/ubuntu/tmp/atomicparsley-20210124.204813.840499f/src/extracts.cpp:1638

I've attached the file. Please download and check the file.
2021-05-04-09_19_50_0x5b55f77d_0xb1c1261c.zip

Copyright tag question

Hi all!

I'm very ignorant about this tool but I noticed that if I run this command:

AtomicParsley file.mp4 --ISO-copyright 'EXAMPLE' --overWrite

Or if I run this command:

AtomicParsley file.mp4 --copyright 'EXAMPLE' --overWrite

Then in VLC that field is not populated at all:

Screenshot_2022_02_22_134435

Can you reproduce this on a random MP4?

All the other fields work instead. Like the title, the album, etc. My question is just related to the copyright field.

I really do not understand how to set it properly to be displayed in VLC.

Thank you so much!

bug: crashes on free() for long rDNS names

Here's a case study for long rDNS names

This Works

$ AtomicParsley song.m4a --rDNSatom "some_value" name="some_key" domain=com.apple.iTunes --output output.m4a

This Doesn't

$ AtomicParsley song.m4a --rDNSatom "some_value" name="some_very_very_very_long_key" domain=com.apple.iTunes --output output.m4a
Started writing to songout.m4a.
 Progress: =====================================================> 97% --|
 Finished writing to songout.m4a.
free(): invalid next size (fast)
[1]    1118984 abort (core dumped)

I mean, it writes the file just fine but panics right before exiting on a memory error at this point:

if (parsedAtoms[iter].AtomicData != NULL) {
free(parsedAtoms[iter].AtomicData);
parsedAtoms[iter].AtomicData = NULL;
}

I haven't looked through the spec, but I have looked through the logic.. shouldn't the static 12 here actually be name_len so it properly allocates enough space for however large the name is?

atomicparsley/src/parsley.cpp

Lines 3502 to 3510 in d91c24c

short rDNS_name_atom = APar_InterjectNewAtom("name",
CHILD_ATOM,
VERSIONED_ATOM,
12,
AtomFlags_Data_Binary,
0,
ilst_atom->AtomicLevel + 2,
rDNS_mean_atom);
uint32_t name_len = strlen(rDNS_atom_name);

Segmentation fault when adding album art

When tagging m4a files with certain album art,
I get files that look like this:
Folder-resized-4446.jpg

Resolution is 1583x1393

The art does not seem to be written to the .m4a file
AtomicParsely dies with:

$  AtomicParsley "track.m4a" -o __temp2435789234759.m4a --artwork Folder.jpg

Segmentation fault: 11

AtomicParsley version is from brew install AtomicParsley on MacOS

$ AtomicParsley -v
AtomicParsley version:   (utf8)

$ brew install AtomicParsley
Warning: atomicparsley 20200701.154658.b0d6223 is already installed and up-to-date
To reinstall 20200701.154658.b0d6223, run `brew reinstall atomicparsley`

Confirmed that the latest GitHub version produces the same error on MacOS

$ git clone https://github.com/wez/atomicparsley.git
$ mkdir build
$ cd build
$ cmake ..
$ make -j 4
$ ./AtomicParsley "track.m4a" -o __temp2435789234759.m4a --artwork Folder.jpg
Segmentation fault: 11
$ ./AtomicParsley -v
AtomicParsley version: 20201231.092811.0 cbecfb1e2238b7c4261074725d25cbb297656c20 (utf8)

Actual files discussed above (I own the (c) rights to these):
Folder-resized-4446.jpg
folder.jpg
track.m4a.zip

Suspect Writing Cast/Crew Atom is Broken

--rDNSatom "MY CAST AND CREW XML HERE" name=iTunMOVI domain=com.apple.iTunes

In older versions of AtomicParsley Mac (AtomicParsley_0.9.5.zip) writing this worked for me.

It doesnt seem to be writing the atom at all now.

Iv very carefully checked the XML I used to embed vs what Im trying to do now and the format is correct.

I used another tool to verify that its not being written to file (all my other atoms do write correctly)

Specifically Im attempting the following, that looks identical to what I did with the older Atomic:
Eh... even in a code block it wont render here, so screenshot...
Screen Shot 2022-06-24 at 10 25 54 AM

Cannot build atomicparsley on Ubuntu 16.04 LTS : CMake 3.10 or higher is required. You are running version 3.5.1

Hi,

I cannot build atomicparsley on Ubuntu 16.04 LTS :

$ CXX=g++-6 cmake .
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  CMake 3.10 or higher is required.  You are running version 3.5.1


-- Configuring incomplete, errors occurred!

The solution is here ๐Ÿ˜„ :

$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2a6d477..318f42a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.5)
 project(AtomicParsley)
 
 if(NOT CMAKE_BUILD_TYPE)

I'll be creating a PR in a moment ...

[Bug Report] "AtomicParsley error: unsupported MPEG-4 file brand found 'iso5'"

AtomicParsely incorrectly labels MP4 videos with ftypiso5 in their header. This is the error message the gets printed when the following command is run on a video with the header mentioned before:

> AtomicParsely iso5brand.mp4 -T
AtomicParsley error: unsupported MPEG-4 file brand found 'iso5'

This is what the header for a mp4 video that produces this error looks like:
Screenshot from 2022-01-12 09-43-44

Note the ftypiso5 in the first few bytes of the header.

This seems to be an issue with libmagic itself. For more information about this bug, see this bug report for libmagic: https://mailman.astron.com/pipermail/file/2020-November/000441.html

Relevant part quoted below:

Hi,
We use libmagic to detect file formats and we got a report[1] that some MP4 files aren't detected properly. The file in question has a "\0\0\0$ftypiso5" signature of which "ftyp" is correctly detected as "ISO Media" (which annoyingly gives a application/octet-steam MIME type instead of some video/* fallback).
The "iso5" part isn't detected by libmagic and looking into /magic/Magdir/animation and https://github.com/FFmpeg/FFmpeg/blob/290de647595051034d8f021f24bb4610b2f39943/libavformat/movenc.c#L4925-L4961 you seem to be lacking a lot of MP4(-ish?) signatures.
Best regards,
Haelwenn (lanodan) Monnier
1: https://git.pleroma.social/pleroma/pleroma/-/issues/2287

src/util.cpp:444:7: error: 'strsep' is missing exception specification 'throw()'

Trying to compile the project on Linux using clang results in the following output:-

[1/2] Building CXX object CMakeFiles/AtomicParsley.dir/src/util.cpp.o
FAILED: CMakeFiles/AtomicParsley.dir/src/util.cpp.o
clang++ -DBUILD_INFO=\"8e81d494c966a3de2ff94f04dceb4778b04ed80d\" -DHAVE_ZLIB_H -DPACKAGE_VERSION=\"20200701.155827.0\" -D_FILE_O
FFSET_BITS=64  -O3 -DNDEBUG -MD -MT CMakeFiles/AtomicParsley.dir/src/util.cpp.o -MF CMakeFiles/AtomicParsley.dir/src/util.cpp.o.d -o CMakeFiles/AtomicParsley.dir/src/ut
il.cpp.o -c ../src/util.cpp
../src/util.cpp:444:7: error: 'strsep' is missing exception specification 'throw()'
char *strsep(char **stringp, const char *delim) {
      ^
                                                throw()
../src/util.h:86:7: note: previous declaration is here
char *strsep(char **stringp, const char *delim);
      ^
1 error generated.

Compiling on Alpine Linux with musl libc fails due to type conversion error.

Hi,

compilation fails with the following error messages. I have modified the offending code and it now comiles and works correctly (I've attached diff to bottom of this message), I'm quite happy to make a pull request etc. but don't have full permissions on github to access it. Can somebody grant me permissions etc. or apply the patches if you don't want any old oik access the source :-)

/dev/shm/atomicparsley-master/src/parsley.cpp:5730:26: error: cannot convert 'off_t*' {aka 'long int*'} to 'const fpos_t*' {aka 'const _G_fpos64_t*'}
 5730 |       fsetpos(dest_file, &file_offset);
      |                          ^~~~~~~~~~~~
      |                          |
      |                          off_t* {aka long int*}
In file included from /usr/include/fortify/stdio.h:22,
                 from /dev/shm/atomicparsley-master/src/AtomicParsley.h:50,
                 from /dev/shm/atomicparsley-master/src/AtomDefs.h:23,
                 from /dev/shm/atomicparsley-master/src/parsley.cpp:30:
/usr/include/stdio.h:85:21: note:   initializing argument 2 of 'int fsetpos(FILE*, const fpos_t*)'
   85 | int fsetpos(FILE *, const fpos_t *);
      |                     ^~~~~~~~~~~~~~
/dev/shm/atomicparsley-master/src/parsley.cpp:5745:26: error: cannot convert 'off_t*' {aka 'long int*'} to 'const fpos_t*' {aka 'const _G_fpos64_t*'}
 5745 |       fsetpos(dest_file, &file_offset);
      |                          ^~~~~~~~~~~~
      |                          |
      |                          off_t* {aka long int*}
In file included from /usr/include/fortify/stdio.h:22,
                 from /dev/shm/atomicparsley-master/src/AtomicParsley.h:50,
                 from /dev/shm/atomicparsley-master/src/AtomDefs.h:23,
                 from /dev/shm/atomicparsley-master/src/parsley.cpp:30:
/usr/include/stdio.h:85:21: note:   initializing argument 2 of 'int fsetpos(FILE*, const fpos_t*)'
   85 | int fsetpos(FILE *, const fpos_t *);
      |                     ^~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/AtomicParsley.dir/build.make:187: CMakeFiles/AtomicParsley.dir/src/parsley.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:96: CMakeFiles/AtomicParsley.dir/all] Error 2
make: *** [Makefile:104: all] Error 2

Stan's diff below

diff /dev/shm/atomicparsley-master/src/parsley.cpp /usr/local/src/atomicparsley/src/parsley.cpp

5726a5727,5732
> #elif defined(fpos64_t)
>       // Using this it's the only way I can identify musl libc
>       // used on Alpine Linux
> 
>       fpos_t file_offset;
>       file_offset.__lldata = dest_position + file_pos;
5741a5748,5753
> #elif defined(fpos64_t)
>       // Using this because it's the only way I can identify musl libc
>       // used on Alpine Linux
> 
>       fpos_t file_offset;
>       file_offset.__lldata = dest_position + file_pos;

Why not exiftool?

Hello,
only from curiosity. No bugs or anything like that I have to report. But isn't what AtomicParsley can't already do with exiftool? Why should one rather use AtomicParsley?

Best regards
UnixCro

How to suppress "modificationTime" tag? (Question)

Is it possible to suppress the "modificationTime" tag? For example:
--manualAtomRemove "moov.udta.meta.ilst.day.data", this removes only the creation time.

Is it possible to make AtomicParsley not stamp the file with the modification time?

Snap 001 โ€ข 2021 05 07 21h24m20s โ€ข  MediaInfo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.