lisamelton / video_transcoding

Tools to transcode, inspect and convert videos.
MIT License
2.39k stars 160 forks source link

transcoding failed #209

Closed ddribin closed 6 years ago

ddribin commented 6 years ago

Hi Don,

It's me again. ;-) I tried converting an MKV I ripped from a Blu-ray and it failed. See attached 2016_World_Series_Game_1_t02.mp4.log

% transcode-video --mp4 2016_World_Series_Game_1_t02.mkv
...
/Users/dave/.gem/ruby/2.3.0/bin/transcode-video: transcoding failed: 2016_World_Series_Game_1_t02.mkv

Here's the MakeMKV screen shot, when I created the MKV:

screen shot 2018-05-18 at 5 27 44 pm

What have I done wrong this time? :)

-Dave

lisamelton commented 6 years ago

@ddribin Hello again! :)

The only curious thing in the .log file you included is the size of the input video: 1280 x 720 pixels. I've never seen that on a Blu-ray Disc before.

Is this actually your entire command line?

transcode-video --mp4 2016_World_Series_Game_1_t02.mkv

Or did you include other options?

Also, can you attach the output of this command?

transcode-video -vv --scan 2016_World_Series_Game_1_t02.mkv

That will tell me much more about your input media.

Thanks.

ddribin commented 6 years ago

Yup, that was the whole command. Attached: transcode-video-scan.txt

And here's a MakeMKV screen shot showing that the source is indeed 720p:

screen shot 2018-05-18 at 9 36 46 pm

FWIW, this is the Blu-ray: http://a.co/bC6jr8Q

Also, how do you get MakeMKV to convert DTS-HD to FLAC? I'm not seeing that option anywhere.

lisamelton commented 6 years ago

@ddribin Thanks! Unfortunately I can't find any smoking gun in that scan output. Dang.

OK, let's use the --dry-run option and take transcode-video out of the equation. Execute this command:

transcode-video --dry-run --mp4 2016_World_Series_Game_1_t02.mkv

And then copy the output back to the command line to invoke HandBrakeCLI directly.

If that still fails, then we've found a bug in HandBrake. You can then try elimination options to find out what HandBrakeCLI is failing on.

As for converting DTS-HD to FLAC, you need to enable "Expert mode" in MakeMKV. You can find that toggle in the "General" tab of the preferences dialog. Once that's enabled, an "Advanced" tab should also appear in preferences. Select "FLAC" as your "Default profile" in the "Advanced" tab.

Then quit and relaunch MakeMKV. Just to be sure. :)

ddribin commented 6 years ago

Yup! HandbrakeCLI is crashing: HandbrakeCLI-fail.txt

I did just upgrade to HandbrakeCLI version 1.1.0. I could try downgrading, to see if that helps.

Thanks for that MakeMKV tip! Maybe that's causing problems, too.

lisamelton commented 6 years ago

@ddribin Before you downgrade, try removing --rate=30 from that HandBrakeCLI command line and see if that fixes the problem. If it doesn't try also removing --pfr.

ddribin commented 6 years ago

Still segfaults with both of those removed:

% HandBrakeCLI --input=2016_World_Series_Game_1_t02.mkv --output=2016_World_Series_Game_1_t02.mp4 --markers --encoder=x264 --crop=0:0:0:0 --auto-anamorphic --encoder-preset=medium --encoder-profile=high --encoder-level=3.1 --quality=1 --audio=1 --aencoder=ca_aac --encopts=vbv-maxrate=3000:vbv-bufsize=6000:crf-max=25:qpmax=34

Apparently I already deleted the old version of Handbrake from brew and there's no easy way to get it back. sigh

lisamelton commented 6 years ago

@ddribin Damn. OK, try this next: replace --audio=1 --aencoder=ca_aac with --audio=none and see what happens.

ddribin commented 6 years ago

Still segfaults.

ddribin commented 6 years ago

It's crashing here:

(lldb) bt
* thread #6, stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
  * frame #0: 0x00000001006dfff0 HandBrakeCLI`rate_estimate_qscale + 31
    frame #1: 0x00000001006dfe03 HandBrakeCLI`x264_8_ratecontrol_start + 891
    frame #2: 0x00000001006fc36c HandBrakeCLI`x264_8_encoder_encode + 6983
    frame #3: 0x000000010003d0be HandBrakeCLI`encx264Work + 750
    frame #4: 0x00000001000727fd HandBrakeCLI`hb_work_loop + 110
    frame #5: 0x0000000100055215 HandBrakeCLI`hb_thread_func + 59
    frame #6: 0x00007fff6595e661 libsystem_pthread.dylib`_pthread_body + 340
    frame #7: 0x00007fff6595e50d libsystem_pthread.dylib`_pthread_start + 377
    frame #8: 0x00007fff6595dbf9 libsystem_pthread.dylib`thread_start + 13
lisamelton commented 6 years ago

@ddribin Woof. OK, strip that command down to the essentials! Try something simple like this:

HandBrakeCLI --input=2016_World_Series_Game_1_t02.mkv --output=2016_World_Series_Game_1_t02.mp4
ddribin commented 6 years ago

Heh, no still crashes at the same spot. ;-)

lisamelton commented 6 years ago

@ddribin Yikes! OK, HandBrakeCLI really doesn't like your input file then. :) Can you try next using the HandBrake app and see if it barfs as well?

ddribin commented 6 years ago

Man, I just pick all the winners, here. FWIW, ffmpeg invoked like this starts chewing away at it:

% ffmpeg -i 2016_World_Series_Game_1_t02.mkv 2016_World_Series_Game_1_t02.mp4
lisamelton commented 6 years ago

@ddribin OK, if ffmpeg can handle it then you've found quite the interesting bug in HandBrakeCLI then.

ddribin commented 6 years ago

Well, so it gets more interesting. The Handbrake app, also version 1.1.0, does not crash. It's chugging away right now:

screen shot 2018-05-19 at 12 30 28 am
lisamelton commented 6 years ago

@ddribin Hmmm, I suspect there might be something odd about your command line environment then. Not sure what to tell you at this point.

ddribin commented 6 years ago

I just tried a "brew uninstall" and a "brew install", and it still crashes. Ah, well. I guess I'll just watch the disc, then. ;-)

skj-dev commented 6 years ago

Perhaps try a nightly build of just the HandBrakeCLI? ( https://handbrake.fr/nightly.php )

By definition a nightly build is expected to be buggier than a regular release, but perhaps the specific bug that you're being bitten by has been resolved either directly or indirectly.

Just thought it was worth a chime in from the peanut gallery. 😸

lisamelton commented 6 years ago

Thanks, @ttyS0! That's a good idea.

lisamelton commented 6 years ago

@ddribin So, do you want to open an issue for the HandBrake developers on their project? Otherwise I'm not sure what else we do here.

ddribin commented 6 years ago

I just tried the HandbrakeCLI v1.1.0 binary directly from handbrake.fr, and it works. So somehow the version getting built by brew is busted.

lisamelton commented 6 years ago

@ddribin Excellent! This is probably why I never install HandBrakeCLI itself using brew. :)

OK, I think this is resolved then so I'll close the issue. Although you might want to open one on that particular Homebrew tap.

ddribin commented 6 years ago

I opened up Homebrew issue #28139: handbrake v1.1.0 installed via Homebrew crashes, but not the official binary installed from handbrake.fr

ddribin commented 6 years ago

@donmelton Thanks again for your help!

lisamelton commented 6 years ago

@ddribin You are very welcome, sir! Your issues are never dull. Keep them coming. :)

queengooborg commented 6 years ago

Hey all, I saw the issue on Homebrew and decided to try my 🍀with it. Interestingly enough, I was able to get HandBrakeCLI via brew to work first try! I used the pre-build binaries that were generated on Homebrew's own Mac mini servers, but building from source caused a segmentation fault during encoding.

ilovezfs commented 6 years ago

The prebuilt bottles are fine, but you're triggering a source build because you're using a non-standard prefix, and there's something wrong with the source build.

So to be clear: Prebuilt binary from upstream: fine Prebuilt binary from Homberew: fine Current source build: not so fine

This is probably why I never install HandBrakeCLI itself using brew. :)

A bit off the mark given the prebuilt binaries from Homebrew are working fine. It does help to have facts before making snarky comments.

ilovezfs commented 6 years ago

Reported upstream https://github.com/HandBrake/HandBrake/issues/1351

lisamelton commented 6 years ago

@vinyldarkscratch and @ilovezfs Thanks for the extra effort to find the root cause and report it!

ddribin commented 6 years ago

Ditto! Thanks @donmelton, @vinyldarkscratch, and @ilovezfs for getting to the bottom of this.