How to handle video files proper?

Hi

The release is a enchanced cd with data track container video in mpg container. Picard ignore the mpg file. I remux it into mp4 container but picard don’t save the video.

Original:

General
Complete name                            : Lexy_KPaul_vicious.mpg
Format                                   : MPEG-PS
File size                                : 39.4 MiB
Duration                                 : 3 min 49 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 1 439 kb/s
Frame rate                               : 25.000 FPS

Video
ID                                       : 224 (0xE0)
Format                                   : MPEG Video
Format version                           : Version 1
Format settings                          : BVOP
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Default
Format settings, GOP                     : M=3, N=12
Duration                                 : 3 min 49 s
Bit rate mode                            : Constant
Bit rate                                 : 1 229 kb/s
Width                                    : 320 pixels
Height                                   : 240 pixels
Display aspect ratio                     : 1.422
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.640
Time code of first frame                 : 00:00:00:00
Time code source                         : Group of pictures header
GOP, Open/Closed                         : Closed
Stream size                              : 33.4 MiB (85%)

Audio
ID                                       : 192 (0xC0)
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 2
Duration                                 : 3 min 49 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 kHz
Frame rate                               : 38.281 FPS (1152 SPF)
Compression mode                         : Lossy
Stream size                              : 5.25 MiB (13%)

Remux:

Complete name                            : new.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/mp41)
File size                                : 39.1 MiB
Duration                                 : 3 min 49 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 1 427 kb/s
Frame rate                               : 25.000 FPS
Writing application                      : Lavf62.12.102

Video
ID                                       : 1
Format                                   : MPEG Video
Format version                           : Version 1
Format settings                          : BVOP
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Default
Format settings, GOP                     : M=3, N=12
Codec ID                                 : mp4v-6A
Duration                                 : 3 min 49 s
Source duration                          : 3 min 49 s
Source_Duration_FirstFrame               : 34 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 170 kb/s
Maximum bit rate                         : 1 229 kb/s
Width                                    : 320 pixels
Height                                   : 240 pixels
Display aspect ratio                     : 3:2
Original display aspect ratio            : 1.422
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.609
Time code of first frame                 : 00:00:00:00
Time code source                         : Group of pictures header
GOP, Open/Closed                         : Closed
Stream size                              : 32.1 MiB (82%)
Source stream size                       : 33.7 MiB (86%)
mdhd_Duration                            : 229840

Audio
ID                                       : 2
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 2
Codec ID                                 : mp4a-6B
Duration                                 : 3 min 49 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 kHz
Compression mode                         : Lossy
Stream size                              : 5.25 MiB (13%)
Default                                  : Yes
Alternate group                          : 1

ffmpeg:

ffmpeg -i Lexy_KPaul_vicious.mpg -c:a copy -c:v copy new.mp4

Also tryed -map_metadata -1 -map_chapters -1 and -movflags +faststart

Picard Version 3.0.0rc1 error:

E: 06:47:15,539 picard\util\thread.run:114: Traceback (most recent call last):

File "picard\util\thread.py", line 111, in run

File "picard\file.py", line 555, in _save_and_rename

AttributeError: 'MP4File' object has no attribute '_loaded_identity'

and

E: 06:47:15,540 picard\item.error_append:149: <MP4File 'new.mp4'>: 'MP4File' object has no attribute '_loaded_identity'

Im using latest Version 3.0.0rc1.

My question is how to handle video files?

The error you posted is a bug that needs to be fixed. But looking at the code this seems to be a secondary error, the file should already have shown an error on loading.

Can you just load the file and see if there is an error and share it here?

What do you mean with “load the file”? When using picard Add File the mp4 video appears in Unclustered Files

but there isn’t any error in the debug log and sometimes the file never apears

D: 23:03:31,912 picard\tagger.add_files:1050: Adding 1 files
D: 23:03:31,913 picard\formats\mp4._load:194: Loading file ‘Z:\incoming\new.mp4’
D: 23:03:31,913 picard\tagger._process_in_batches:876: [timings] File load dispatch: 1 items, 0 remaining
D: 23:03:31,935 picard\debug_opts.timing:109: suspend_while_loading_exit in 0.0 ms
D: 23:03:31,935 picard\file.move:860: Moving <MP4File ‘new.mp4’> from None to <Cluster ‘Unclustered Files’>
D: 23:03:31,936 picard\debug_opts.timing:109: Cluster.add_files: 1 items to tree in 1.2 ms
D: 23:03:31,937 picard\tagger._process_callback_batch:908: [timings] Callback batch: 1 items, 0 queued

When only one release i add and can save the release with the mp4.

When multiple releases i can’t even add the mp4 files into picard i have to drag and drop and then in the end i can’t save the release with the video file.

this is very hard to debug. can’t find anything new in the debug logs that could help so far. but there is a problem.

I asked because the error on saving you posted before is a bug, but from what I can see in the code the only way to trigger it is if loading the file already failed.

So loading the same file, sometimes it shows up, sometimes not? Or are we talking about different files? Please note that Picard does not support all video files. It does support MP4, because that’s just a container format and Picard does support this (from the perspective of Picard there is no difference in tagging an MP4 whether it contains audio only or video). But it does not support e.g. .mpeg files.

Can you explain what you mean with you can’t add the mp4 to Picard?

Also, saving the file then always fails with the error you posted? Or is it saving and nothing happens to the file?

Maybe you can share a screenshot of what you are seeing.

1 Like

here are two video files hope that clear the situation more than writing down more words.

first just one release and everything works.

after the video i paused i added my library and after that finished i record the second where the problem appears.

if steam not allowed please let me know and how i should share the files here. thank you !

1 Like

Thank you very much for this detailed screencasts. This indeed helps very much understanding what is happening.

The issue though is very odd. There are two parts to this: Why is the file not showing after “Add Files”, and why does it error on save.

I’m not entirely sure, but I have a suspicion for the first issue: I think “Add Files” does add the file, but it goes directly to the right. When the file gets added, you can see the “Pending files” icon in the statusbar at the bottom to show 1. But for some reason the pending status never changes.

Only when you drag the file from outside again the pending disappears. If you drag a file from outside directly to e.g. “Unclustered files” Picard is moving the already loaded file there, so this part is expected. The question is, where is the file before, and why does it not stop to be pending (and no error is logged).

The second issue then is I think a result of the loading not finishing properly. I have today merged a fix for this part, so the saving error should no longer happen. Could you try a daily portable build from Release MusicBrainz Picard daily builds · phw/picard-daily · GitHub ? It already contains the fix.

However, the first issue with the file being stuck pending is probably the more serious one. Can you please try the two things:

  1. With nothing else loaded: Enable debug mode in the log window. Just load this one video file via “Add File”. Does it show up on the right? What does the numbers in the status bar show? Please share the debug log output.
  2. Could you also share the full metadata of this file? In Picard 3 you can click into the metadata view at the bottom, press Ctrl + A to select everything, then Ctrl + C to copy. You can copy it here in a code block. If the issue lies with the metadata I hope to be able to reproduce the issue.
4 Likes

i all do this with the latest daily build without configure anything at all. the debug log for point 1 and the statusbar at bottom show “1 Files”

I: 23:01:04,510 picard\util\readthedocs._call_api:126: Documentation updates disabled in user settings.
I: 23:01:04,743 picard\browser\server.start:125: Browser Integration: Starting, listening on address 127.0.0.1 and port 8000
W: 23:01:04,793 picard\ui\statusindicator\windows.init:55: Failed initializing taskbar integration
Traceback (most recent call last):
File "picard\ui\statusindicator\windows.py", line 49, in init
File "comtypes\client_generate.py", line 111, in GetModule
File "comtypes\client_generate.py", line 136, in _load_tlib
File "comtypes\typeinfo.py", line 693, in LoadTypeLibEx
File "_ctypes/callproc.c", line 1037, in GetResult
OSError: [WinError -2147312566] Error loading type library/DLL
I: 23:01:14,815 picard\ui\mainwindow._check_for_plugin_updates:2196: Skipping plugin update checks based on user settings
D: 23:01:28,748 picard\tagger.add_files:1056: Adding 1 files
D: 23:01:28,748 picard\tagger._process_in_batches:882: [timings] File load dispatch: 1 items, 0 remaining
D: 23:01:28,749 picard\formats\mp4._load:194: Loading file 'Z:\videofix.mp4'
D: 23:01:28,782 picard\debug_opts.timing:109: suspend_while_loading_exit in 0.0 ms
D: 23:01:28,782 picard\file.move:867: Moving <MP4File 'videofix.mp4'> from None to <Cluster 'Unclustered Files'>
D: 23:01:28,784 picard\debug_opts.timing:109: Cluster.add_files: 1 items to tree in 1.4 ms
D: 23:01:28,786 picard\tagger._process_callback_batch:914: [timings] Callback batch: 1 items, 0 queued

The text from metadataview:

encodedby Lavf62.12.102 Lavf62.12.102
~filepath Z:\videofix.mp4 Z:\videofix.mp4
~length 3:57 3:57
title videofix videofix

When loading my library and try the same i still fail to load the mp4 like in the video i share previous. The last log lines are:

D: 23:16:48,907 picard\webservice\ratecontrol._out_of_backoff:237: [ratecontrol] ('``coverartarchive.org``', 443): oobackoff; delay: 15ms -> 7ms; slow start; window size 7.000 -> 8.000
D: 23:16:48,908 picard\tagger._process_callback_batch:914: [timings] Callback batch: 1 items, 0 queued
D: 23:23:19,169 picard\tagger._process_callback_batch:914: [timings] Callback batch: 1 items, 0 queued
D: 23:23:19,190 picard\tagger._process_callback_batch:914: [timings] Callback batch: 1 items, 0 queued
D: 23:23:25,339 picard\tagger.add_files:1056: Adding 1 files
D: 23:23:25,339 picard\tagger._process_in_batches:882: [timings] File load dispatch: 1 items, 0 remaining

and don’t change anymore when try to add the file nothing changes. but the mediainfo tab at bottom is different when drag and drop the same file:

~filepath Z:\videofix.mp4 Z:\videofix.mp4
~length ?:?? ?:??

but what is fixed is i can save the release with the video file now. but still the “Add File” don’t work after i load my library.

1 Like

Thanks again for testing and the report, and sorry for the delay.

Picard somehow seems to hang when loading this file. But I don’t understand why the way of loading would make a difference.

In the case of loading the library the file seems to stay pending (and likely isn’t visible in the UI yet, there is no log line saysing the file gets moved to e.g. unclustered files). Adding the file again seems to move the visible file item over to unclustered. But that it shows no length now also indicates it somehow hangs with loading.

I have no good idea yet. Loading a file should either succeed or fail, but not be stuck like this. Maybe Picard is still busy with other tasks? But then the status bar should show pending requests or such.

I go debugging and try to reproduce the situation.