Error writing trailer Error number # occurred

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
milonic
Posts: 11
Joined: Mon Jul 19, 2021 7:49 pm

Error writing trailer Error number # occurred

Post by milonic »

Hi All,

Been using Zoneminder for a few years but unfortunately I now have some issues.

First post here as generally Zoneminder has been pretty well behaved, this was until I upgraded the Fedora 33 box to 34 and I've had no end of issues since then.

Issue I'd like to fix is I get a "Error writing trailer Error number # occurred" error every time an event is recorded.

The system is running Fedora 34 and Zoneminder 1.36.5. 14 cameras in total. All running 1080p linked to 640x480 sub cameras. CPU is i5-3470 and there's 16gb ram.

Does anybody have any idea what the problem is?

Thanks,
Andy
User avatar
iconnor
Posts: 2880
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Error writing trailer Error number # occurred

Post by iconnor »

Turn on debug logging and post the results.

Also need to know if you are doing passthrough or encoding.
milonic
Posts: 11
Joined: Mon Jul 19, 2021 7:49 pm

Re: Error writing trailer Error number # occurred

Post by milonic »

All cameras are doing Passthrough

I have set debugging to on and have a snapshot but there's a lot of chatter.

How's the best way of getting this data over to you?

Does the following help?

Code: Select all

09/27/21 11:32:16.905785 zmc_m10[171244].DB1-zm_packetqueue.cpp/336 [Deleting a packet with stream index:0 image_index:693 with keyframe:0, video frames in queue:422 max: 5, queuesize:9]
09/27/21 11:32:16.905795 zmc_m10[171244].DB4-zm_packet.h/112 [packet 693 unlocked]
09/27/21 11:32:16.905805 zmc_m10[171244].DB4-zm_packet.h/99 [locking packet 694]
09/27/21 11:32:16.905817 zmc_m10[171244].DB4-zm_packet.h/102 [packet 694 locked]
09/27/21 11:32:16.905826 zmc_m10[171244].DB1-zm_packetqueue.cpp/336 [Deleting a packet with stream index:0 image_index:694 with keyframe:0, video frames in queue:422 max: 5, queuesize:8]
09/27/21 11:32:16.905836 zmc_m10[171244].DB4-zm_packet.h/112 [packet 694 unlocked]
09/27/21 11:32:16.905847 zmc_m10[171244].DB4-zm_packet.h/99 [locking packet 695]
09/27/21 11:32:16.905857 zmc_m10[171244].DB4-zm_packet.h/102 [packet 695 locked]
09/27/21 11:32:16.905866 zmc_m10[171244].DB1-zm_packetqueue.cpp/336 [Deleting a packet with stream index:0 image_index:695 with keyframe:0, video frames in queue:422 max: 5, queuesize:7]
09/27/21 11:32:16.905877 zmc_m10[171244].DB4-zm_packet.h/112 [packet 695 unlocked]
09/27/21 11:32:16.905886 zmc_m10[171244].DB4-zm_packet.h/99 [locking packet 696]
09/27/21 11:32:16.905897 zmc_m10[171244].DB4-zm_packet.h/102 [packet 696 locked]
09/27/21 11:32:16.905906 zmc_m10[171244].DB1-zm_packetqueue.cpp/336 [Deleting a packet with stream index:0 image_index:696 with keyframe:0, video frames in queue:422 max: 5, queuesize:6]
09/27/21 11:32:16.905917 zmc_m10[171244].DB4-zm_packet.h/112 [packet 696 unlocked]
09/27/21 11:32:16.905926 zmc_m10[171244].DB4-zm_packet.h/99 [locking packet 697]
09/27/21 11:32:16.905936 zmc_m10[171244].DB4-zm_packet.h/102 [packet 697 locked]
09/27/21 11:32:16.905946 zmc_m10[171244].DB1-zm_packetqueue.cpp/336 [Deleting a packet with stream index:0 image_index:697 with keyframe:0, video frames in queue:422 max: 5, queuesize:5]
09/27/21 11:32:16.905956 zmc_m10[171244].DB4-zm_packet.h/112 [packet 697 unlocked]
09/27/21 11:32:16.905966 zmc_m10[171244].DB4-zm_packet.h/99 [locking packet 698]
09/27/21 11:32:16.905976 zmc_m10[171244].DB4-zm_packet.h/102 [packet 698 locked]
09/27/21 11:32:16.905985 zmc_m10[171244].DB1-zm_packetqueue.cpp/336 [Deleting a packet with stream index:0 image_index:698 with keyframe:0, video frames in queue:422 max: 5, queuesize:4]
09/27/21 11:32:16.905995 zmc_m10[171244].DB4-zm_packet.h/112 [packet 698 unlocked]
09/27/21 11:32:16.906010 zmc_m10[171244].DB4-zm_packet.h/99 [locking packet 699]
09/27/21 11:32:16.906022 zmc_m10[171244].DB4-zm_packet.h/102 [packet 699 locked]
09/27/21 11:32:16.906033 zmc_m10[171244].DB1-zm_packetqueue.cpp/336 [Deleting a packet with stream index:0 image_index:699 with keyframe:0, video frames in queue:422 max: 5, queuesize:3]
09/27/21 11:32:16.906043 zmc_m10[171244].DB4-zm_packet.h/112 [packet 699 unlocked]
09/27/21 11:32:16.906053 zmc_m10[171244].DB4-zm_packet.h/99 [locking packet 700]
09/27/21 11:32:16.906064 zmc_m10[171244].DB4-zm_packet.h/102 [packet 700 locked]
09/27/21 11:32:16.906073 zmc_m10[171244].DB1-zm_packetqueue.cpp/336 [Deleting a packet with stream index:0 image_index:700 with keyframe:1, video frames in queue:422 max: 5, queuesize:2]
09/27/21 11:32:16.906083 zmc_m10[171244].DB4-zm_packet.h/112 [packet 700 unlocked]
09/27/21 11:32:16.906098 zmc_m10[171244].DB4-zm_packet.h/99 [locking packet 701]
09/27/21 11:32:16.906108 zmc_m10[171244].DB4-zm_packet.h/102 [packet 701 locked]
09/27/21 11:32:16.906117 zmc_m10[171244].DB1-zm_packetqueue.cpp/336 [Deleting a packet with stream index:0 image_index:701 with keyframe:0, video frames in queue:422 max: 5, queuesize:1]
09/27/21 11:32:16.906127 zmc_m10[171244].DB4-zm_packet.h/112 [packet 701 unlocked]
09/27/21 11:32:16.906143 zmc_m10[171244].DB1-zm_packetqueue.cpp/348 [Packetqueue is clear, deleting iterators]
09/27/21 11:32:16.906153 zmc_m10[171244].DB1-zm_packetqueue.cpp/363 [Packetqueue is clear, notifying]
09/27/21 11:32:16.906164 zmc_m10[171244].INF-zm_monitor.cpp/3107 [Gate: image_count:702 - Closing event 6076404, shutting down]
09/27/21 11:32:16.906174 zmc_m10[171244].DB1-zm_monitor.cpp/2779 [close event thread is not joinable]
09/27/21 11:32:16.906184 zmc_m10[171244].DB1-zm_monitor.cpp/2781 [Starting thread to close event]
09/27/21 11:32:16.906237 zmc_m10[171244].DB1-zm_monitor.cpp/2783 [Nulling event]
09/27/21 11:32:16.906260 zmc_m10[171472].DB4-zm_event.cpp/230 [Deleting video store]
09/27/21 11:32:16.906307 zmc_m10[171472].DB4-zm_videostore.cpp/636 [Flushing interleaved queues]
09/27/21 11:32:16.906472 zmc_m10[171472].DB8-zm_ffmpeg.cpp/69 [av_interleaved_write_frame FLUSH]
09/27/21 11:32:16.906666 zmc_m10[171472].DB1-zm_videostore.cpp/639 [Writing trailer]
09/27/21 11:32:16.907280 zmc_m10[171472].ERR-zm_videostore.cpp/642 [Error writing trailer Error number 162 occurred]
09/27/21 11:32:16.907305 zmc_m10[171472].DB4-zm_videostore.cpp/650 [Closing]
09/27/21 11:32:16.907317 zmc_m10[171472].DB2-zm_ffmpeg.cpp/69 [Statistics: 0 seeks, 8 writeouts]
09/27/21 11:32:16.907337 zmc_m10[171472].DB3-zm_videostore.cpp/670 [Freeing video_out_ctx]
09/27/21 11:32:16.907350 zmc_m10[171472].DB4-zm_videostore.cpp/724 [free context]
09/27/21 11:32:16.907369 zmc_m10[171472].DB4-zm_swscale.cpp/69 [SWScale object destroyed]
09/27/21 11:32:16.907380 zmc_m10[171472].DB2-zm_event.cpp/242 [start_time: 1632738710. 434244 end_time: 1632738716.417874]
09/27/21 11:32:16.907391 zmc_m10[171472].DB1-zm_event.cpp/451 [Inserting 7 frames]
09/27/21 11:32:16.910263 zmc_m10[171246].DB1-zm_db.cpp/189 [Success running sql query INSERT INTO `Logs` ( `TimeKey`, `Component`, `ServerId`, `Pid`, `Level`, `Code`, `Message`, `File`, `Line` ) VALUES ( 1632738736.907280, 'zmc_m10', 0, 171472, -2, 'ERR', 'Error writing trailer Error number 162 occurred', 'zm_videostore.cpp', 642 )]
09/27/21 11:32:16.913356 zmc_m10[171246].DB1-zm_db.cpp/189 [Success running sql query INSERT INTO `Frames` (`EventId`, `FrameId`, `Type`, `TimeStamp`, `Delta`, `Score`) VALUES 
( 6076404, 110, 'Alarm', from_unixtime( 1632738716 ), 5.69, 10 ),
( 6076404, 111, 'Alarm', from_unixtime( 1632738716 ), 5.74, 10 ),
( 6076404, 112, 'Alarm', from_unixtime( 1632738716 ), 5.79, 10 ),
( 6076404, 113, 'Alarm', from_unixtime( 1632738716 ), 5.84, 10 ),
( 6076404, 114, 'Alarm', from_unixtime( 1632738716 ), 5.89, 10 ),
( 6076404, 115, 'Alarm', from_unixtime( 1632738716 ), 5.94, 10 ),
( 6076404, 116, 'Alarm', from_unixtime( 1632738716 ), 5.99, 10 )]
09/27/21 11:32:16.937043 zmc_m10[171472].DB2-zm_db.cpp/218 [Success running sql update UPDATE Events SET Name='Event-6076404', EndDateTime = from_unixtime(1632738716), Length = 5.99, Frames = 116, AlarmFrames = 107, TotScore = 785, AvgScore = 7, MaxScore = 10 WHERE Id = 6076404 AND Name='New Event'. Rows modified 1]
09/27/21 11:32:17.005687 zmc_m10[171244].DB8-zm_ffmpeg.cpp/69 [Sending:
TEARDOWN rtsp://10.0.4.4/mpeg4/ RTSP/1.0
CSeq: 6
User-Agent: Lavf58.76.100
Session: 65F436BE

--]
09/27/21 11:32:17.005718 zmc_m10[171244].DB1-zm_ffmpeg_camera.cpp/621 [Received terminate in cb]
09/27/21 11:32:17.089026 zmc_m10[171244].DB1-zm_db.cpp/189 [Success running sql query INSERT INTO Monitor_Status (MonitorId,Status) VALUES (10, 'NotRunning') ON DUPLICATE KEY UPDATE Status='NotRunning']
09/27/21 11:32:17.089058 zmc_m10[171244].DB1-zmc.cpp/381 [terminating]
09/27/21 11:32:17.089170 undef[171244].DB1-zm_logger.cpp/224 [LogOpts: level=DB9 effective=DB9, screen=OFF, database=OFF, logfile=DB9->/var/log/zoneminder/zm_debug.log.171244, syslog=DB9]
09/27/21 11:32:17.089202 undef[171244].DB1-zm_packetqueue.cpp/328 [Clearing packetqueue]
09/27/21 11:32:17.089215 undef[171244].DB1-zm_packetqueue.cpp/348 [Packetqueue is clear, deleting iterators]
09/27/21 11:32:17.089227 undef[171244].DB1-zm_packetqueue.cpp/363 [Packetqueue is clear, notifying]
09/27/21 11:32:17.089277 undef[171244].DB1-zm_packetqueue.cpp/328 [Clearing packetqueue]
09/27/21 11:32:17.089295 undef[171244].DB1-zm_packetqueue.cpp/348 [Packetqueue is clear, deleting iterators]
09/27/21 11:32:17.089305 undef[171244].DB1-zm_packetqueue.cpp/363 [Packetqueue is clear, notifying]
09/27/21 11:32:17.089315 undef[171244].DB4-zm_packetqueue.cpp/70 [Done in destructor]
twmag
Posts: 1
Joined: Tue Sep 28, 2021 10:36 pm

Re: Error writing trailer Error number # occurred

Post by twmag »

I have run into the same issue on my clean install. Other than the error message I don't see any issues. I'm able to view the event video fine.

One camera. Passthrough. Not capturing any images. ffmpeg sourcing an RTSP stream.

Code: Select all

09/28/21 15:55:09.062747 zmc_m6[33475].DB1-zm_image.cpp/323 [dest frame after convert: format 26 rgba 2592x1944 linesize:10368x0 pts: 2147400 keyframe: 1]
09/28/21 15:55:09.064916 zmc_m6[33476].DB1-zm_monitor.cpp/1896 [Detecting motion on image 477, image 0x7f8fa8d85090]
09/28/21 15:55:09.073492 zmc_m6[33476].DB1-zm_zone_stats.h/54 [ZoneStat: GetStats zone_id: 6 pixel_diff=42 alarm_pixels=12266 alarm_filter_pixels=0 alarm_blob_pixels=0 alarm_blobs=0 min_blob_size=0 max_blob_size=0 alarm_box=(0,0=>0,0) alarm_center=(0,0) score=0]
09/28/21 15:55:09.073553 zmc_m6[33476].DB1-zm_zone_stats.h/54 [ZoneStat: After detect motion zone_id: 6 pixel_diff=42 alarm_pixels=12266 alarm_filter_pixels=0 alarm_blob_pixels=0 alarm_blobs=0 min_blob_size=0 max_blob_size=0 alarm_box=(0,0=>0,0) alarm_center=(0,0) score=0]
09/28/21 15:55:09.073562 zmc_m6[33476].INF-zm_monitor.cpp/2152 [AMC1: 477 - Left alarm state (609) - 197(44) images]
09/28/21 15:55:09.073632 zmc_m6[33476].INF-zm_monitor.cpp/2157 [AMC1: 477 - Closing event 609, alarm end]
09/28/21 15:55:09.073671 zmc_m6[33476].DB1-zm_monitor.cpp/2779 [close event thread is not joinable]
09/28/21 15:55:09.073679 zmc_m6[33476].DB1-zm_monitor.cpp/2781 [Starting thread to close event]
09/28/21 15:55:09.073775 zmc_m6[33476].DB1-zm_monitor.cpp/2783 [Nulling event]
09/28/21 15:55:09.073788 zmc_m6[33476].DB1-zm_monitor.cpp/2245 [Blending]
09/28/21 15:55:09.073888 zmc_m6[33481].DB1-zm_videostore.cpp/639 [Writing trailer]
09/28/21 15:55:09.073966 zmc_m6[33481].INF-zm_ffmpeg.cpp/69 [Estimating the duration of the last packet in a fragment, consider setting the duration field in AVPacket instead.]
09/28/21 15:55:09.075467 zmc_m6[33481].ERR-zm_videostore.cpp/642 [Error writing trailer Error number 143 occurred]
09/28/21 15:55:09.075652 zmc_m6[33481].DB1-zm_event.cpp/451 [Inserting 8 frames]
09/28/21 15:55:09.075717 zmc_m6[33471].DB1-zm_db.cpp/189 [Success running sql query INSERT INTO `Logs` ( `TimeKey`, `Component`, `ServerId`, `Pid`, `Level`, `Code`, `Message`, `File`, `Line` ) VALUES ( 1632869709.073562, 'zmc_m6', 0, 33476, 0, 'INF', 'AMC1: 477 - Left alarm state (609) - 197(44) images', 'zm_monitor.cpp', 2152 )]
09/28/21 15:55:09.077223 zmc_m6[33471].DB1-zm_db.cpp/189 [Success running sql query INSERT INTO `Logs` ( `TimeKey`, `Component`, `ServerId`, `Pid`, `Level`, `Code`, `Message`, `File`, `Line` ) VALUES ( 1632869709.073632, 'zmc_m6', 0, 33476, 0, 'INF', 'AMC1: 477 - Closing event 609, alarm end', 'zm_monitor.cpp', 2157 )]
09/28/21 15:55:09.077258 zmc_m6[33476].DB1-zm_monitor.cpp/2247 [Done Blending]
09/28/21 15:55:09.077301 zmc_m6[33476].DB1-zm_monitor.cpp/2268 [Deleting image data for 477]
09/28/21 15:55:09.077328 zmc_m6[33476].DB1-zm_monitor.cpp/1678 [analysis_image_count(478) motion_count(477) fps_report_interval(100) mod0]
09/28/21 15:55:09.078157 zmc_m6[33471].DB1-zm_db.cpp/189 [Success running sql query INSERT INTO `Logs` ( `TimeKey`, `Component`, `ServerId`, `Pid`, `Level`, `Code`, `Message`, `File`, `Line` ) VALUES ( 1632869709.073966, 'zmc_m6', 0, 33481, 0, 'INF', 'Estimating the duration of the last packet in a fragment, consider setting the duration field in AVPacket instead.', 'zm_ffmpeg.cpp', 69 )]
09/28/21 15:55:09.079624 zmc_m6[33471].DB1-zm_db.cpp/189 [Success running sql query INSERT INTO `Frames` (`EventId`, `FrameId`, `Type`, `TimeStamp`, `Delta`, `Score`) VALUES 
09/28/21 15:55:09.080729 zmc_m6[33471].DB1-zm_db.cpp/189 [Success running sql query INSERT INTO `Stats` (`EventId`, `FrameId`, `MonitorId`, `ZoneId`, `PixelDiff`, `AlarmPixels`, `FilterPixels`, `BlobPixels`,`Blobs`,`MinBlobSize`, `MaxBlobSize`, `MinX`, `MinY`, `MaxX`, `MaxY`,`Score`) VALUES 

User avatar
iconnor
Posts: 2880
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Error writing trailer Error number # occurred

Post by iconnor »

I'm going to have to read the ffmpeg source code to figure out what those errors mean.
tortho
Posts: 11
Joined: Tue May 25, 2021 8:56 pm
Location: Sandefjord, Norway

Re: Error writing trailer Error number # occurred

Post by tortho »

Got the same errors.
Zoneminder 1.36.8 dmo2
Debian bookworm
Foscam cameras (various models) with passthrough

They more or less match with the time of events on the respective monitors.

iconnor pm me if you want to have a look with with teamviewer.

2021-10-10 22:30:00 zmc_m8 186003 ERR Error writing trailer Error number 11890 occurred zm_videostore.cpp 642
2021-10-10 22:30:00 zmc_m2 186002 ERR Error writing trailer Error number 11510 occurred zm_videostore.cpp 642
2021-10-10 22:27:12 web_php 182955 ERR No data to read from socket /usr/share/zoneminder/www/includes/functions.php 1902
2021-10-10 22:27:12 web_php 182955 ERR Timed out waiting for msg /run/zm/zms-975776s.sock /usr/share/zoneminder/www/ajax/stream.php 95
2021-10-10 22:26:55 web_php 183828 ERR No zoom type selected. Please select Continuous, Relative, Absolute /usr/share/zoneminder/www/includes/Control.php 139
2021-10-10 22:20:00 zmc_m8 185141 ERR Error writing trailer Error number 11890 occurred zm_videostore.cpp 642
2021-10-10 22:20:00 zmc_m2 185140 ERR Error writing trailer Error number 11510 occurred zm_videostore.cpp 642
2021-10-10 22:16:51 zmc_m1 185073 ERR Error writing trailer Error number 2200 occurred zm_videostore.cpp 642
2021-10-10 22:16:49 zmc_m7 185069 ERR Error writing trailer Error number 2276 occurred zm_videostore.cpp 642
2021-10-10 22:10:00 zmc_m8 184900 ERR Error writing trailer Error number 11890 occurred zm_videostore.cpp 642
2021-10-10 22:10:00 zmc_m2 184899 ERR Error writing trailer Error number 11510 occurred zm_videostore.cpp 642
2021-10-10 22:00:00 zmc_m8 184746 ERR Error writing trailer Error number 11890 occurred zm_videostore.cpp 642
2021-10-10 22:00:00 zmc_m2 184745 ERR Error writing trailer Error number 11510 occurred zm_videostore.cpp 642
2021-10-10 21:50:00 zmc_m2 184640 ERR Error writing trailer Error number 11510 occurred zm_videostore.cpp 642
2021-10-10 21:50:00 zmc_m8 184639 ERR Error writing trailer Error number 11928 occurred zm_videostore.cpp 642
2021-10-10 21:40:00 zmc_m2 184532 ERR Error writing trailer Error number 11510 occurred zm_videostore.cpp 642
2021-10-10 21:40:00 zmc_m8 184531 ERR Error writing trailer Error number 11890 occurred zm_videostore.cpp 642
2021-10-10 21:30:00 zmc_m2 184378 ERR Error writing trailer Error number 11510 occurred zm_videostore.cpp 642
2021-10-10 21:30:00 zmc_m8 184377 ERR Error writing trailer Error number 11890 occurred zm_videostore.cpp 642
2021-10-10 21:20:00 zmc_m2 184236 ERR Error writing trailer Error number 11510 occurred zm_videostore.cpp 642
2021-10-10 21:20:00 zmc_m8 184235 ERR Error writing trailer Error number 11928 occurred zm_videostore.cpp 642
2021-10-10 21:10:00 zmc_m2 184158 ERR Error writing trailer Error number 20440 occurred zm_videostore.cpp 642
Post Reply