Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#11118 closed Bug Report - General (fixed)

Lossless transcode fail with "avcodec_encode_video failed"

Reported by: stuartm Owned by: beirdo
Priority: blocker Milestone: 0.26
Component: MythTV - Mythtranscode Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no


Seems to apply to every recording I've tried, including a few which are 4-5 years old. The presence/use of cutlists doesn't seem to make a difference.

mythtranscode --honorcutlist -i /mnt/myth2/17070_20111203040800.mpg
2012-09-23 22:06:21.827818 C  mythtranscode version: master [v0.26-rc2-37-g154d72b-dirty]
2012-09-23 22:06:21.827857 C  Qt version: compile: 4.8.2, runtime: 4.8.2
2012-09-23 22:06:21.827863 N  Enabled verbose msgs:  general
2012-09-23 22:06:21.827884 N  Setting Log Level to LOG_INFO
2012-09-23 22:06:21.828566 I  Added logging to the console
2012-09-23 22:06:21.829284 I  Setup Interrupt handler
2012-09-23 22:06:21.829299 I  Setup Terminated handler
2012-09-23 22:06:21.829310 I  Setup Segmentation fault handler
2012-09-23 22:06:21.829319 I  Setup Aborted handler
2012-09-23 22:06:21.829329 I  Setup Bus error handler
2012-09-23 22:06:21.829338 I  Setup Floating point exception handler
2012-09-23 22:06:21.829347 I  Setup Illegal instruction handler
2012-09-23 22:06:21.829362 I  Setup Real-time signal 0 handler
2012-09-23 22:06:21.829435 N  Using runtime prefix = /usr/local
2012-09-23 22:06:21.829457 N  Using configuration directory = /home/gbee/.mythtv
2012-09-23 22:06:21.829569 I  Assumed character encoding: en_GB.UTF-8
2012-09-23 22:06:21.830901 N  Empty LocalHostName.
2012-09-23 22:06:21.830915 I  Using localhost value of scafell
2012-09-23 22:06:21.863822 N  Setting QT default locale to en_GB
2012-09-23 22:06:21.863848 I  Current locale en_GB
2012-09-23 22:06:21.863925 N  Reading locale defaults from /usr/local/share/mythtv//locales/en_gb.xml
2012-09-23 22:06:21.882031 I  Loading en_gb translation for module mythfrontend
2012-09-23 22:06:21.887247 N  Transcoding from /mnt/myth2/17070_20111203040800.mpg to /mnt/myth2/17070_20111203040800.mpg.tmp
2012-09-23 22:06:21.962794 I  MythCoreContext: Connecting to backend server: (try 1 of 1)
2012-09-23 22:06:21.965219 I  Using protocol version 75
2012-09-23 22:06:21.987947 I  AFD: Opened codec 0x2418d80, id(MPEG2VIDEO) type(Video)
2012-09-23 22:06:21.987962 I  AFD: codec MP2 has 2 channels
2012-09-23 22:06:21.988078 I  AFD: Opened codec 0x2461a20, id(MP2) type(Audio)
2012-09-23 22:06:21.988116 I  AFD: codec MP2 has 2 channels
2012-09-23 22:06:21.988182 I  AFD: Opened codec 0x2462300, id(MP2) type(Audio)
2012-09-23 22:06:21.988255 I  AFD: Opened codec 0x24635c0, id(DVB_SUBTITLE) type(Subtitle)
2012-09-23 22:06:21.988435 N  AudioPlayer: Enabling Audio
2012-09-23 22:06:22.027222 I  Honoring the cutlist while transcoding
2012-09-23 22:06:22.030567 I  Cutlist        : 0-4117,6865-74877
2012-09-23 22:06:22.030599 I  Original Length: 74877 frames
2012-09-23 22:06:22.030605 I  New Length     : 2748 frames
2012-09-23 22:06:22.032071 N  Transcode: Looking for autodetect profile: Autodetect from 576i
2012-09-23 22:06:22.058809 E  SampleRate: Attempted to add a rate 32000 Hz, which is not in the list of allowed rates.
2012-09-23 22:06:22.060167 I  Added logging to mythlogserver at TCP:35327
2012-09-23 22:06:22.064195 N  Transcode: Using autodetect profile: MPEG2
2012-09-23 22:06:22.064279 N  Switching to MPEG-2 transcoder.
2012-09-23 22:06:22.068004 I  Starting process manager
2012-09-23 22:06:22.068968 I  Starting process signal handler
2012-09-23 22:06:22.069371 I  Starting IO manager (read)
2012-09-23 22:06:22.074463 I  Starting IO manager (write)
2012-09-23 22:06:22.176458 I  Opening /mnt/myth2/17070_20111203040800.mpg
2012-09-23 22:06:22.183562 I  Invalid extradata, subtitle streams may be combined!
2012-09-23 22:06:22.184237 I  Header missing
2012-09-23 22:06:22.185107 I  Header missing
2012-09-23 22:06:22.208299 I  PES packet size mismatch
2012-09-23 22:06:22.208322 I  PES packet size mismatch
2012-09-23 22:06:22.208338 I  PES packet size mismatch
2012-09-23 22:06:22.208388 I  Input #0, mpegts, from '/mnt/myth2/17070_20111203040800.mpg':
2012-09-23 22:06:22.208411 I    Duration: 00:49:56.15, start: 14378.927611, bitrate: 7004 kb/s
2012-09-23 22:06:22.208480 I      Stream #0:0[0xd04]: Video: mpeg2video (Main), yuv420p, 704x576 [SAR 16:11 DAR 16:9], 10000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
2012-09-23 22:06:22.208499 I      Stream #0:1[0xd05](eng): Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
2012-09-23 22:06:22.208514 I      Stream #0:2[0xd06](NAR): Audio: mp2, 48000 Hz, stereo, s16, 128 kb/s
2012-09-23 22:06:22.208528 I      Stream #0:3[0x938](eng): Subtitle: dvb_teletext
2012-09-23 22:06:22.208540 I      Stream #0:4[0x939](eng): Subtitle: dvb_subtitle
2012-09-23 22:06:22.208616 E  Skipping unsupported codec 3 on stream 3
2012-09-23 22:06:22.208624 E  Skipping unsupported codec 3 on stream 4
2012-09-23 22:06:22.213730 I  #0 PTS:03:59:39.513 Delta: 0.0ms queue: 11
2012-09-23 22:06:22.213771 I  #1 PTS:03:59:39.509 Delta: 4.14444ms queue: 2
2012-09-23 22:06:22.213790 I  #2 PTS:03:59:39.504 Delta: 9.18889ms queue: 7
2012-09-23 22:06:23.585671 I  Del map found 0 at 4117 (4117)
2012-09-23 22:06:23.648221 E  avcodec_encode_video failed (0)
2012-09-23 22:06:23.648793 E  Transcoding /mnt/myth2/17070_20111203040800.mpg failed
2012-09-23 22:06:23.648866 I  Waiting for threads to exit.

Attachments (2)

0001-Fix-video-encode-in-MPEG2-lossless-transcoding.patch (4.1 KB) - added by beirdo 5 years ago.
mythtranscode.20120924142637.21697.log (95.6 KB) - added by George Nassas <gnassas@…> 5 years ago.
CoreContext? mpeg2fix.cpp:698 (AddFrame?) - Deadlock detected. One buffer is full when the other is empty! Aborting

Download all attachments as: .zip

Change History (9)

comment:1 Changed 5 years ago by beirdo

I think the attached patch should fix it. If you could try that out on your test cases...

Changed 5 years ago by beirdo

comment:2 Changed 5 years ago by stuartm

The patch does the trick, thank you.

comment:3 Changed 5 years ago by beirdo

Excellent. I'll get that into master then.

comment:4 Changed 5 years ago by Gavin Hurlbut <ghurlbut@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 8611c6e6873b21fb53217146a9f790c3721833be/mythtv:

Fix video encode in MPEG2 "lossless" transcoding

Fixes #11118

It seems that the new video encode API call pipelines the encoding, returning
after each input frame, but not returning a packet the first time around in all
cases. This change makes it encode the packet, and then keep calling the API
until a packet has actually been encoded (flushing the output).

comment:5 Changed 5 years ago by George Nassas <gnassas@…>

I just tried this and my transcode failed with "CoreContext? mpeg2fix.cpp:698 (AddFrame?) - Deadlock detected. One buffer is full when the other is empty! Aborting" but I'm not totally sure if this is due to the fix or a new issue. I'll leave it to you to decide between reopening the ticket or asking me to create a new one.

I'll also attach the full transcode log.

Changed 5 years ago by George Nassas <gnassas@…>

CoreContext? mpeg2fix.cpp:698 (AddFrame?) - Deadlock detected. One buffer is full when the other is empty! Aborting

comment:6 Changed 5 years ago by stuartm

That's not a regression caused by this fix, it's not even a new issue but a very, very old one that no-one has ever figured out. There are lots of tickets for it, possibly one is still open but given that the bug has existed since the lossless mpeg2 transcode has existed I wouldn't bank on a quick fix.

comment:7 Changed 5 years ago by scott.harris0509@…

I'm not so sure of that. I am now seeing the "one buffer full" error on all losless transcodes, having never seen it before in many years of using Myth. Something has introduced it.

Add Comment

Modify Ticket

as closed The owner will remain beirdo.
The resolution will be deleted. Next status will be 'new'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.