-1

I have an issue opening Adobe Media Encoder's txt log file.

The log itself looks like this:

 - Source File: /var/folders/3t/fwptgmxx4h9bkt7j0tt6wx_h0000gn/T/Untitled Project_AME/tmpAEtoAMEProject-0_RENDER.aep ... etc...

However when I try to copy it here I get this weird stuff in the preview:

� � � �-� �S�o�u�r�c�e� �F�i�l�e�:� �/�v�a�r�/�f�o�l�d�e�r�s�/�3�t�/�f�w�p�t�g�m�x�x�4�h�9�b�k�t�7�j�0�t�t�6�w�x�_�h�0�0�0�0�g�n�/�T�/�U�n�t�i�t�l�e�d� �P�r�o�j�e�c�t�_�A�M�E�/�t�m�p�A�E�t�o�A�M�E�P�r�o�j�e�c�t�-

When I try to splitlines() the string - it returns as I understand hex:

\n\x00\n\x00\n\x000\x005\x00/\x002\x007\x00/\x002\x000\x002\x001\x00 \x000\x004\x00:\x00

By far my code is:

with open(config.ame_log_file, mode='rb') as amelog_file:
    amelog = amelog_file.read()
    stringer = amelog.decode('utf-8', 'backslashreplace')

This STRINGER variable is a multiline string. When I PRINT it using python - I get normal text. However I can't find() anything in it. Regular expressions don't work neither. I can't manipulate the string. Though upper() still works. array square bracket notation [] also works.

Please can you help me?

I've tried all the encodings like utf 8, 16, 32, be, le. Nothing helps.

05/27/2021 04:29:30 PM : Queue Started

  • Source File: /var/folders/3t/fwptgmxx4h9bkt7j0tt6wx_h0000gn/T/Untitled Project_AME/tmpAEtoAMEProject-0_RENDER.aep
  • Output File: /Users/tim/Downloads/Tim-gfx-1621932918_2.mp4
  • Preset Used: Match Source - High bitrate
  • Video: 1920x1080 (1.0), 25 fps, Progressive, Hardware Encoding, 00:00:30:00
  • Audio: AAC, 320 kbps, 48 kHz, Stereo
  • Bitrate: VBR, 1 pass, Target 10.00 Mbps
  • Encoding Time: 00:00:29 05/27/2021 04:30:00 PM : File Successfully Encoded

05/27/2021 04:30:00 PM : Queue Stopped

I get the same output in the stdout when I print(file.read()) even withoout any encoding/decoding.

If I capture stdout to a variable and print it back again I get this:

['', '\x00', '\x00', '\x000\x005\x00/\x002\x007\x00/\x002\x000\x002\x001\x00 \x000\x004\x00:\x002\x009\x00:\x003\x000\x00 \x00P\x00M\x00 \x00:\x00 \x00Q\x00u\x00e\x00u\x00e\x00 \x00S\x00t\x00a\x00r\x00t\x00e\x00d\x00', '\x00', '\x00', '\x00 \x00-\x00 \x00S\x00o\x00u\x00r\x00c\x00e\x00 \x00F\x00i\x00l\x00e\x00:\x00 \x00/\x00v\x00a\x00r\x00/\x00f\x00o\x00l\x00d\x00e\x00r\x00s\x00/\x003\x00t\x00/\x00f\x00w\x00p\x00t\x00g\x00m\x00x\x00x\x004\x00h\x009\x00b\x00k\x00t\x007\x00j\x000\x00t\x00t\x006\x00w\x00x\x00_\x00h\x000\x000\x000\x000\x00g\x00n\x00/\x00T\x00/\x00U\x00n\x00t\x00i\x00t\x00l\x00e\x00d\x00 \x00P\x00r\x00o\x00j\x00e\x00c\x00t\x00_\x00A\x00M\x00E\x00/\x00t\x00m\x00p\x00A\x00E\x00t\x00o\x00A\x00M\x00E\x00P\x00r\x00o\x00j\x00e\x00c\x00t\x00-\x000\x00_\x00R\x00E\x00N\x00D\x00E\x00R\x00.\x00a\x00e\x00p\x00', '\x00 \x00-\x00 \x00O\x00u\x00t\x00p\x00u\x00t\x00 \x00F\x00i\x00l\x00e\x00:\x00 \x00/\x00U\x00s\x00e\x00r\x00s\x00/\x00t\x00i\x00m\x00/\x00D\x00o\x00w\x00n\x00l\x00o\x00a\x00d\x00s\x00/\x00T\x00i\x00m\x00-\x00g\x00f\x00x\x00-\x001\x006\x002\x001\x009\x003\x002\x009\x001\x008\x00_\x002\x00.\x00m\x00p\x004\x00', '\x00 \x00-\x00 \x00P\x00r\x00e\x00s\x00e\x00t\x00 \x00U\x00s\x00e\x00d\x00:\x00 \x00M\x00a\x00t\x00c\x00h\x00 \x00S\x00o\x00u\x00r\x00c\x00e\x00 \x00-\x00 \x00H\x00i\x00g\x00h\x00 \x00b\x00i\x00t\x00r\x00a\x00t\x00e\x00', '\x00 \x00-\x00 \x00V\x00i\x00d\x00e\x00o\x00:\x00 \x001\x009\x002\x000\x00x\x001\x000\x008\x000\x00 \x00(\x001\x00.\x000\x00)\x00,\x00 \x002\x005\x00 \x00f\x00p\x00s\x00,\x00 \x00P\x00r\x00o\x00g\x00r\x00e\x00s\x00s\x00i\x00v\x00e\x00,\x00 \x00H\x00a\x00r\x00d\x00w\x00a\x00r\x00e\x00 \x00E\x00n\x00c\x00o\x00d\x00i\x00n\x00g\x00,\x00 \x000\x000\x00:\x000\x000\x00:\x003\x000\x00:\x000\x000\x00', '\x00 \x00-\x00 \x00A\x00u\x00d\x00i\x00o\x00:\x00 \x00A\x00A\x00C\x00,\x00 \x003\x002\x000\x00 \x00k\x00b\x00p\x00s\x00,\x00 \x004\x008\x00 \x00k\x00H\x00z\x00,\x00 \x00S\x00t\x00e\x00r\x00e\x00o\x00', '\x00 \x00-\x00 \x00B\x00i\x00t\x00r\x00a\x00t\x00e\x00:\x00 \x00V\x00B\x00R\x00,\x00 \x001\x00 \x00p\x00a\x00s\x00s\x00,\x00 \x00T\x00a\x00r\x00g\x00e\x00t\x00 \x001\x000\x00.\x000\x000\x00 \x00M\x00b\x00p\x00s\x00', '\x00 \x00-\x00 \x00E\x00n\x00c\x00o\x00d\x00i\x00n\x00g\x00 \x00T\x00i\x00m\x00e\x00:\x00 \x000\x000\x00:\x000\x000\x00:\x002\x009\x00', '\x000\x005\x00/\x002\x007\x00/\x002\x000\x002\x001\x00 \x000\x004\x00:\x003\x000\x00:\x000\x000\x00 \x00P\x00M\x00 \x00:\x00 \x00F\x00i\x00l\x00e\x00 \x00S\x00u\x00c\x00c\x00e\x00s\x00s\x00f\x00u\x00l\x00l\x00y\x00 \x00E\x00n\x00c\x00o\x00d\x00e\x00d\x00', '\x00', '\x00', '\x000\x005\x00/\x002\x007\x00/\x002\x000\x002\x001\x00 \x000\x004\x00:\x003\x000\x00:\x000\x000\x00 \x00P\x00M\x00 \x00:\x00 \x00Q\x00u\x00e\x00u\x00e\x00 \x00S\x00t\x00o\x00p\x00p\x00e\x00d\x00 ']

if I open this file in binary and print it's contents I get bytes object:

b'\n\x00\n\x00\n\x000\x005\x00/\x002\x007\x00/\x002\x000\x002\x001\x00 \x000\x004\x00:\x002\x009\x00:\x003\x000\x00 \x00P\x00M\x00 \x00:\x00 \x00Q\x00u\x00e\x00u\x00e\x00 \x00S\x00t\x00a\x00r\x00t\x00e\x00d\x00\n\x00\n\x00\n\x00 \x00-\x00 \x00S\x00o\x00u\x00r\x00c\x00e\x00 \x00F\x00i\x00l\x00e\x00:\x00 \x00/\x00v\x00a\x00r\x00/\x00f\x00o\x00l\x00d\x00e\x00r\x00s\x00/\x003\x00t\x00/\x00f\x00w\x00p\x00t\x00g\x00m\x00x\x00x\x004\x00h\x009\x00b\x00k\x00t\x007\x00j\x000\x00t\x00t\x006\x00w\x00x\x00_\x00h\x000\x000\x000\x000\x00g\x00n\x00/\x00T\x00/\x00U\x00n\x00t\x00i\x00t\x00l\x00e\x00d\x00 \x00P\x00r\x00o\x00j\x00e\x00c\x00t\x00_\x00A\x00M\x00E\x00/\x00t\x00m\x00p\x00A\x00E\x00t\x00o\x00A\x00M\x00E\x00P\x00r\x00o\x00j\x00e\x00c\x00t\x00-\x000\x00_\x00R\x00E\x00N\x00D\x00E\x00R\x00.\x00a\x00e\x00p\x00\n\x00 \x00-\x00 \x00O\x00u\x00t\x00p\x00u\x00t\x00 \x00F\x00i\x00l\x00e\x00:\x00 \x00/\x00U\x00s\x00e\x00r\x00s\x00/\x00t\x00i\x00m\x00/\x00D\x00o\x00w\x00n\x00l\x00o\x00a\x00d\x00s\x00/\x00T\x00i\x00m\x00-\x00g\x00f\x00x\x00-\x001\x006\x002\x001\x009\x003\x002\x009\x001\x008\x00_\x002\x00.\x00m\x00p\x004\x00\n\x00 \x00-\x00 \x00P\x00r\x00e\x00s\x00e\x00t\x00 \x00U\x00s\x00e\x00d\x00:\x00 \x00M\x00a\x00t\x00c\x00h\x00 \x00S\x00o\x00u\x00r\x00c\x00e\x00 \x00-\x00 \x00H\x00i\x00g\x00h\x00 \x00b\x00i\x00t\x00r\x00a\x00t\x00e\x00\n\x00 \x00-\x00 \x00V\x00i\x00d\x00e\x00o\x00:\x00 \x001\x009\x002\x000\x00x\x001\x000\x008\x000\x00 \x00(\x001\x00.\x000\x00)\x00,\x00 \x002\x005\x00 \x00f\x00p\x00s\x00,\x00 \x00P\x00r\x00o\x00g\x00r\x00e\x00s\x00s\x00i\x00v\x00e\x00,\x00 \x00H\x00a\x00r\x00d\x00w\x00a\x00r\x00e\x00 \x00E\x00n\x00c\x00o\x00d\x00i\x00n\x00g\x00,\x00 \x000\x000\x00:\x000\x000\x00:\x003\x000\x00:\x000\x000\x00\n\x00 \x00-\x00 \x00A\x00u\x00d\x00i\x00o\x00:\x00 \x00A\x00A\x00C\x00,\x00 \x003\x002\x000\x00 \x00k\x00b\x00p\x00s\x00,\x00 \x004\x008\x00 \x00k\x00H\x00z\x00,\x00 \x00S\x00t\x00e\x00r\x00e\x00o\x00\n\x00 \x00-\x00 \x00B\x00i\x00t\x00r\x00a\x00t\x00e\x00:\x00 \x00V\x00B\x00R\x00,\x00 \x001\x00 \x00p\x00a\x00s\x00s\x00,\x00 \x00T\x00a\x00r\x00g\x00e\x00t\x00 \x001\x000\x00.\x000\x000\x00 \x00M\x00b\x00p\x00s\x00\n\x00 \x00-\x00 \x00E\x00n\x00c\x00o\x00d\x00i\x00n\x00g\x00 \x00T\x00i\x00m\x00e\x00:\x00 \x000\x000\x00:\x000\x000\x00:\x002\x009\x00\n\x000\x005\x00/\x002\x007\x00/\x002\x000\x002\x001\x00 \x000\x004\x00:\x003\x000\x00:\x000\x000\x00 \x00P\x00M\x00 \x00:\x00 \x00F\x00i\x00l\x00e\x00 \x00S\x00u\x00c\x00c\x00e\x00s\x00s\x00f\x00u\x00l\x00l\x00y\x00 \x00E\x00n\x00c\x00o\x00d\x00e\x00d\x00\n\x00\n\x00\n\x000\x005\x00/\x002\x007\x00/\x002\x000\x002\x001\x00 \x000\x004\x00:\x003\x000\x00:\x000\x000\x00 \x00P\x00M\x00 \x00:\x00 \x00Q\x00u\x00e\x00u\x00e\x00 \x00S\x00t\x00o\x00p\x00p\x00e\x00d\x00 '
  • 3
    The file is clearly UTF-16; you have to specify the encoding. – tripleee May 28 '21 at 07:09
  • I don't think you have properly tried to decode it using `utf-16le`. But we can't decide the encoding based on a copy/paste using an unknown encoding. Please [edit] to supply (a representative, ideally small sample of) the actual contents of the data in an unambiguous representation; a hex dump of the problematic byte(s) with a few bytes of context on each side is often enough, especially if you can tell us what you think those bytes are supposed to represent. See also https://meta.stackoverflow.com/questions/379403/problematic-questions-about-decoding-errors – tripleee May 28 '21 at 11:25
  • Okay, I'll add more snippets to the post. By the way this is the link to the text file https://drive.google.com/file/d/1LlIk3MxOeXqY-v8xa5vR2s81XZnMS9b4/view?usp=sharing – Тимур Тимаев May 28 '21 at 11:41
  • Thanks for the edit. The data you show appears to be truncated, but I can decode the start of it just fine. Demo: https://ideone.com/WupnEj – tripleee May 28 '21 at 11:57
  • Thank you very much! I saved b[0:190].decode('utf-16le') to a variable and it's now an operable string. Please can you suggest a way to ignore truncated undecodable bytes so I can extract as much text from my bytes as I can? – Тимур Тимаев May 28 '21 at 12:34
  • okay. the 'ignore' argument got me the full text representation. Thank you! – Тимур Тимаев May 28 '21 at 13:10

1 Answers1

1

Big thanks to @tripleee the problem was solved.

Working string is in decoded variable.

with open(config.ame_log_file, 'rb') as amelog_file:
    amelog = amelog_file.read()
    decoded = amelog.decode('utf-16le', 'ignore')