Handbrake 1.0.7 hangs on QSV encoding

Archive of historical bug reports.
Please use the GitHub link above to report issues.
Forum rules
*******************************

Please be aware we are now using GitHub for issue tracking and feature requests.

- This forum is now closed to new topics.
- Existing topics will remain open for a short while as the transition over occurs.
*******************************
User avatar
s55
HandBrake Team
Posts: 9218
Joined: Sun Dec 24, 2006 1:05 pm

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by s55 » Fri Jul 14, 2017 7:52 pm

I suspect you just missed johns changes. That's a build from 2~3 days ago.

You have to watch closely as there isn't always a nightly build!

rboy
Posts: 35
Joined: Sun Jul 09, 2017 12:11 am

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rboy » Tue Jul 18, 2017 5:30 pm

Bingo! it's working again with the latest nightly build. Thanks guys - you're awesome!

rollin_eng
Veteran User
Posts: 2881
Joined: Wed May 04, 2011 11:06 pm

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rollin_eng » Tue Jul 18, 2017 5:38 pm

It would be interesting to see your log for this encode.

rboy
Posts: 35
Joined: Sun Jul 09, 2017 12:11 am

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rboy » Tue Jul 18, 2017 5:59 pm

Is there some instruction for building 32bit handbrake? I'm assuming the only difference is a cross compiler. Can I use an already built cross compiler and if not what would be the command to build a i686 cross compiler?

User avatar
s55
HandBrake Team
Posts: 9218
Joined: Sun Dec 24, 2006 1:05 pm

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by s55 » Tue Jul 18, 2017 6:00 pm

https://handbrake.fr/docs/en/1.0.0/deve ... ndows.html

Using i686 rather than x86_64 but do note we no longer support, test or fix issues under 32bit (for which there are a few). If you can, you'd be best trying to move to a 64bit OS.

rboy
Posts: 35
Joined: Sun Jul 09, 2017 12:11 am

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rboy » Tue Jul 18, 2017 6:01 pm

Code: Select all

[13:59:39] hb_init: starting libhb thread
[13:59:39] thread 1 started ("libhb")
HandBrake 20170714072747-b77f66d-master (2017071801) - MinGW x86_64 - https://handbrake.fr
4 CPUs detected
Opening ..\Handbrake QSV Fail.ts...
[13:59:39] CPU: Intel(R) Core(TM) i7-3540M CPU @ 3.00GHz
[13:59:39]  - Intel microarchitecture Ivy Bridge
[13:59:39]  - logical processor count: 4
[13:59:39] Intel Quick Sync Video support: yes
[13:59:39]  - Intel Media SDK hardware: API 1.11 (minimum: 1.3)
[13:59:39]  - H.264 encoder: yes
[13:59:39]     - preferred implementation: hardware (any)
[13:59:39]     - capabilities (hardware):  vsinfo opt1 opt2+extbrc+ib_adapt+nmpslice
[13:59:39]  - H.265 encoder: no
[13:59:39] hb_scan: path=..\Handbrake QSV Fail.ts, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:274: failed opening UDF image ..\Handbrake QSV Fail.ts
src/libbluray/disc/disc.c:352: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:352: error opening file BDMV\BACKUP\index.bdmv
[13:59:39] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 5.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[13:59:39] dvd: not a dvd - trying as a stream/file instead
[13:59:39] file is MPEG Transport Stream with 188 byte packets offset 0 bytes
[13:59:39] Found the following PIDS
[13:59:39]     Video PIDS :
[13:59:39]       0x100 type MPEG2 (0x2) (PCR)
[13:59:39]     Audio PIDS :
[13:59:39]       0x101 type AC3 (0x81)
[13:59:39]     Subtitle PIDS :
[13:59:39]     Other PIDS :
[13:59:39] stream id 0x101 (type 0x81 substream 0x0) audio 0x101
Scanning title 1 of 1, 0.00 %[13:59:40] hb_sample_pts: no PTS in video packet near 287840205
[13:59:40] hb_sample_pts: no PTS in video packet near 293026515
Scanning title 1 of 1, 0.00 %[13:59:40] hb_sample_pts: no PTS in video packet near 298212825
[13:59:40] hb_sample_pts: no PTS in video packet near 303399135
[13:59:40] hb_sample_pts: no PTS in video packet near 308585445
Scanning title 1 of 1, 0.00 %[13:59:41] scan: decoding previews for title 1
[13:59:41] file is MPEG Transport Stream with 188 byte packets offset 0 bytes
[13:59:41] scan: audio 0x101: ac3, rate=48000Hz, bitrate=192000 English (AC3) (2.0 ch)
Scanning title 1 of 1, preview 6, 60.00 %[13:59:41] stream: 6 good frames, 0 errors (0%)
[13:59:41] scan: 10 previews, 704x480, 29.970 fps, autocrop = 2/0/0/0, aspect 16:9, PAR 40:33
[13:59:41] libhb: scan thread found 1 valid title(s)
+ Using preset: CLI Default
+ title 1:
  + stream: ..\Handbrake QSV Fail.ts
  + duration: 00:00:00
  + size: 704x480, pixel aspect: 40/33, display aspect: 1.78, 29.970 fps
  + autocrop: 2/0/0/0
  + chapters:
    + 1: cells 0->0, 0 blocks, duration 00:00:00
  + audio tracks:
    + 1, English (AC3) (2.0 ch) (iso639-2: eng), 48000Hz, 192000bps
  + subtitle tracks:
    + 1, English, Closed Caption [CC]
[13:59:41] 1 job(s) to process
[13:59:41] json job:
{
    "Audio": {
        "AudioList": [
            {
                "Bitrate": 384,
                "CompressionLevel": -1.0,
                "DRC": 0.0,
                "DitherMethod": "auto",
                "Encoder": "ac3",
                "Gain": 0.0,
                "Mixdown": "stereo",
                "NormalizeMixLevel": false,
                "PresetEncoder": "ac3",
                "Quality": -3.0,
                "Samplerate": 0,
                "Track": 0
            }
        ],
        "CopyMask": [
            "copy:aac",
            "copy:ac3",
            "copy:eac3",
            "copy:dtshd",
            "copy:dts",
            "copy:mp3",
            "copy:truehd",
            "copy:flac"
        ],
        "FallbackEncoder": "av_aac"
    },
    "Destination": {
        "AlignAVStart": false,
        "ChapterList": [
            {
                "Name": "Chapter 1"
            }
        ],
        "ChapterMarkers": false,
        "File": "test.mp4",
        "Mp4Options": {
            "IpodAtom": false,
            "Mp4Optimize": false
        },
        "Mux": "m4v"
    },
    "Filters": {
        "FilterList": [
            {
                "ID": 6,
                "Settings": {
                    "mode": 0
                }
            },
            {
                "ID": 11,
                "Settings": {
                    "crop-bottom": 0,
                    "crop-left": 0,
                    "crop-right": 0,
                    "crop-top": 2,
                    "height": 478,
                    "width": 704
                }
            }
        ]
    },
    "Metadata": {},
    "PAR": {
        "Den": 33,
        "Num": 40
    },
    "SequenceID": 0,
    "Source": {
        "Angle": 0,
        "Path": "..\\Handbrake QSV Fail.ts",
        "Range": {
            "End": 1,
            "Start": 1,
            "Type": "chapter"
        },
        "Title": 1
    },
    "Subtitle": {
        "Search": {
            "Burn": true,
            "Default": false,
            "Enable": false,
            "Forced": false
        },
        "SubtitleList": []
    },
    "Video": {
        "ColorMatrixCode": 0,
        "Encoder": "qsv_h264",
        "QSV": {
            "AsyncDepth": 4,
            "Decode": false
        },
        "Quality": 49.0,
        "Turbo": false,
        "TwoPass": false
    }
}
[13:59:41] starting job
[13:59:41] job configuration:
[13:59:41]  * source
[13:59:41]    + ..\Handbrake QSV Fail.ts
[13:59:41]    + title 1, chapter(s) 1 to 1
[13:59:41]  * destination
[13:59:41]    + test.mp4
[13:59:41]    + container: MPEG-4 (libavformat)
[13:59:41]  * video track
[13:59:41]    + decoder: mpeg2video
[13:59:41]      + bitrate 15000 kbps
[13:59:41]    + filters
[13:59:41]      + Framerate Shaper (mode=0)
[13:59:41]        + frame rate: same as source (around 29.970 fps)
[13:59:41]      + Crop and Scale (width=704:height=478:crop-top=2:crop-bottom=0:crop-left=0:crop-right=0)
[13:59:41]        + source: 704 * 480, crop (2/0/0/0): 704 * 478, scale: 704 * 478
[13:59:41]    + Output geometry
[13:59:41]      + storage dimensions: 704 x 478
[13:59:41]      + pixel aspect ratio: 40 : 33
[13:59:41]      + display dimensions: 853 x 478
[13:59:41]    + encoder: H.264 (Intel Media SDK)
[13:59:41]      + quality: 49.00 (QP)
[13:59:41]  * audio track 1
[13:59:41]    + decoder: English (AC3) (2.0 ch) (track 1, id 0x101)
[13:59:41]      + bitrate: 192 kbps, samplerate: 48000 Hz
[13:59:41]    + mixdown: Stereo
[13:59:41]    + encoder: AC3 (libavcodec)
[13:59:41]      + bitrate: 384 kbps, samplerate: 48000 Hz
[13:59:41] file is MPEG Transport Stream with 188 byte packets offset 0 bytes
[13:59:41] sync: expecting 20 video frames
[13:59:41] encqsvInit: using encode-only path
[13:59:41] encqsvInit: H.264/AVC High profile @ level 3.0
[13:59:41] encqsvInit: TargetUsage 2 AsyncDepth 4
[13:59:41] encqsvInit: GopRefDist 4 GopPicSize 32 NumRefFrame 2
[13:59:41] encqsvInit: BFramesMax 3
[13:59:41] encqsvInit: RateControlMethod CQP with QPI 49 QPP 51 QPB 51
Encoding: task 1 of 1, 0.00 %[13:59:41] sync: first pts audio 0x101 is 0
[13:59:41] sync: first pts video is 9671
Encoding: task 1 of 1, 100.00 %[13:59:42] qsv_enc_init: using 'hardware (1)' implementation, API: 1.11
Encoding: task 1 of 1, 100.00 %[13:59:44] sync: video time went backwards 33 ms, dropped 1 frames. PTS 3814472
Encoding: task 1 of 1, 100.00 %[13:59:44] sync: video time went backwards 200 ms, dropped 6 frames. PTS 4885584
[13:59:44] sync: video time went backwards 133 ms, dropped 4 frames. PTS 4897621
[13:59:44] sync: video time went backwards 166 ms, dropped 5 frames. PTS 4909621
Encoding: task 1 of 1, 100.00 %[13:59:44] sync: video time went backwards 33 ms, dropped 1 frames. PTS 4912919
Encoding: task 1 of 1, 100.00 %[13:59:55] sync: video time went backwards 367 ms, dropped 11 frames. PTS 30952225
Encoding: task 1 of 1, 100.00 %[13:59:56] sync: video time went backwards 47247 ms, dropped 1416 frames. PTS 30964512
Encoding: task 1 of 1,[13:59:58] sync: video time went backwards 33 ms, dropped 1 frames. PTS 35689878
Encoding: task 1 of 1, 100.00 %[13:59:59] sync: video time went backwards 66 ms, dropped 2 frames. PTS 36819006
[13:59:59] sync: video time went backwards 166 ms, dropped 5 frames. PTS 36846030
Encoding: task 1 of 1, 100.00 %[13:59:59] sync: video time went backwards 33 ms, dropped 1 frames. PTS 37032219
Encoding: task 1 of 1, 100.00 %[14:00:11] sync: video time went backwards 33 ms, dropped 1 frames. PTS 57824866
[14:00:11] sync: video time went backwards 33 ms, dropped 1 frames. PTS 57921085
[14:00:11] sync: video time went backwards 33 ms, dropped 1 frames. PTS 57966130
[14:00:11] sync: video time went backwards 33 ms, dropped 1 frames. PTS 58044331
[14:00:11] sync: video time went backwards 33 ms, dropped 1 frames. PTS 58137424
[14:00:11] sync: video time went backwards 33 ms, dropped 1 frames. PTS 58248446
[14:00:11] sync: video time went backwards 66 ms, dropped 2 frames. PTS 58266464
Encoding: task 1 of 1, 100.00 %[14:00:16] sync: video time went backwards 33 ms, dropped 1 frames. PTS 69509537
Encoding: task 1 of 1, 100.00 %[14:00:17] sync: video time went backwards 33 ms, dropped 1 frames. PTS 71606997
[14:00:17] sync: video time went backwards 367 ms, dropped 11 frames. PTS 71610239
[14:00:17] sync: video time went backwards 300 ms, dropped 9 frames. PTS 71923227
Encoding: task 1 of 1, 100.00 %[14:00:17] sync: audio 0x101 time went backwards 32 ms, dropped 1 frames. PTS 77331712
Encoding: task 1 of 1, 100.00 %[14:00:19] sync: audio 0x101 time went backwards 32 ms, dropped 1 frames. PTS 126275333
Encoding: task 1 of 1, 100.00 %[14:00:20] sync: video time went backwards 100 ms, dropped 3 frames. PTS 71926245
[14:00:20] sync: video time went backwards 33 ms, dropped 1 frames. PTS 71932251
[14:00:20] sync: video time went backwards 133 ms, dropped 4 frames. PTS 163537662
[14:00:20] sync: video time went backwards 133 ms, dropped 4 frames. PTS 163540702
[14:00:20] sync: video time went backwards 66 ms, dropped 2 frames. PTS 163546708
Encoding: task 1 of 1, 100.00 %[14:00:36] hb_ts_stream_decode - eof
[14:00:36] reader: done. 731 scr changes
Encoding: task 1 of 1, 100.00 %[14:00:36] work: average encoding speed for job is 578.723206 fps
[14:00:36] vfr: lost time: 1378 (0 frames)
[14:00:36] vfr: gained time: 1378 (88 frames) (0 not accounted for)
[14:00:36] stream: 53893 good frames, 0 errors (0%)
[14:00:36] ac3-decoder done: 55207 frames, 0 decoder errors
En[14:00:36] mpeg2video-decoder done: 53330 frames, 0 decoder errorsc
od[14:00:36] sync: got 22514 frames, 20 expectedi
ng[14:00:36] sync: framerate min 0.001 fps, max 90000.000 fps, avg 12.379 fps
Muxing: this may take awhile...[14:00:36] mux: track 0, 21928 frames, 5891862 bytes, 25.73 kbps, fifo 8192
[14:00:36] mux: track 1, 57233 frames, 87909888 bytes, 383.98 kbps, fifo 8192
[14:00:36] libhb: work result = 0

Encode done!

HandBrake has exited.

rboy
Posts: 35
Joined: Sun Jul 09, 2017 12:11 am

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rboy » Tue Jul 18, 2017 6:03 pm

s55 wrote:
Tue Jul 18, 2017 6:00 pm
https://handbrake.fr/docs/en/1.0.0/deve ... ndows.html

Using i686 rather than x86_64 but do note we no longer support, test or fix issues under 32bit (for which there are a few). If you can, you'd be best trying to move to a 64bit OS.
Thank you!

rboy
Posts: 35
Joined: Sun Jul 09, 2017 12:11 am

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rboy » Tue Jul 18, 2017 7:13 pm

@s55 it's failing while trying to build, any suggestions?

Code: Select all

  : yasm -f win32  -DPREFIX -I./ -I./ -Pconfig.asm -I libavcodec/x86/ -M -o libavcodec/x86/apedsp.o libavcodec/x86/apedsp.asm > libavcodec/x86/apedsp.d
  : libavcodec/x86/ac3dsp_init.c: In function 'ac3_downmix_sse':
  : libavcodec/x86/ac3dsp_init.c:72:5: error: 'asm' operand has impossible constraints
  :      __asm__ volatile (                                          \
  :      ^
  : libavcodec/x86/ac3dsp_init.c:156:9: note: in expansion of macro 'MIX5'
  :          MIX5(IF0, IF1);
  :          ^~~~
  : libavcodec/x86/ac3dsp_init.c:72:5: error: 'asm' operand has impossible constraints
  :      __asm__ volatile (                                          \
  :      ^
  : libavcodec/x86/ac3dsp_init.c:160:9: note: in expansion of macro 'MIX5'
  :          MIX5(IF1, IF0);
  :          ^~~~
  : make[1]: *** [libavcodec/x86/ac3dsp_init.o] Error 1
  : make[1]: *** Waiting for unfinished jobs....
  : yasm -f win32  -DPREFIX -I./ -I./ -Pconfig.asm -I libavcodec/x86/ -o libavcodec/x86/ac3dsp.o libavcodec/x86/ac3dsp.asm
  : yasm -f win32  -DPREFIX -I./ -I./ -Pconfig.asm -I libavcodec/x86/ -o libavcodec/x86/apedsp.o libavcodec/x86/apedsp.asm
  : i686-w64-mingw32-strip -wN '..@*' libavcodec/x86/apedsp.o
  : i686-w64-mingw32-strip -wN '..@*' libavcodec/x86/ac3dsp.o
  : make[1]: Leaving directory `/handbrake/HandBrake/build/contrib/ffmpeg/libav-12.1'
  : make: *** [contrib/ffmpeg/.stamp.build] Error 2

User avatar
s55
HandBrake Team
Posts: 9218
Joined: Sun Dec 24, 2006 1:05 pm

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by s55 » Tue Jul 18, 2017 7:22 pm

My guess is you have a toolchain issue. Assuming you compiled the toolchain as instructed and added it to the PATH, my guess might be yasm version.

rboy
Posts: 35
Joined: Sun Jul 09, 2017 12:11 am

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rboy » Wed Jul 19, 2017 6:06 am

s55 wrote:
Tue Jul 18, 2017 7:22 pm
My guess is you have a toolchain issue. Assuming you compiled the toolchain as instructed and added it to the PATH, my guess might be yasm version.
Just to be sure I did a fresh install of 16.04 and followed the instructions on the page, just replaced x86_64 with i686 and set the PATH and I got this error

Code: Select all

  : yasm -f win32  -DPREFIX -I./ -I./ -Pconfig.asm -I libavcodec/x86/ -o libavcodec/x86/ac3dsp.o libavcodec/x86/ac3dsp.asm
  : yasm -f win32  -DPREFIX -I./ -I./ -Pconfig.asm -I libavcodec/x86/ -M -o libavcodec/x86/apedsp.o libavcodec/x86/apedsp.asm > libavcodec/x86/apedsp.d
  : libavcodec/x86/ac3dsp_init.c: In function 'ac3_downmix_sse':
  : libavcodec/x86/ac3dsp_init.c:72:5: error: 'asm' operand has impossible constraints
  :      __asm__ volatile (                                          \
  :      ^
  : libavcodec/x86/ac3dsp_init.c:156:9: note: in expansion of macro 'MIX5'
  :          MIX5(IF0, IF1);
  :          ^~~~
  : libavcodec/x86/ac3dsp_init.c:72:5: error: 'asm' operand has impossible constraints
  :      __asm__ volatile (                                          \
  :      ^
  : libavcodec/x86/ac3dsp_init.c:160:9: note: in expansion of macro 'MIX5'
  :          MIX5(IF1, IF0);
  :          ^~~~
  : Makefile:48: recipe for target 'libavcodec/x86/ac3dsp_init.o' failed
  : make[1]: *** [libavcodec/x86/ac3dsp_init.o] Error 1
  : make[1]: *** Waiting for unfinished jobs....
  : yasm -f win32  -DPREFIX -I./ -I./ -Pconfig.asm -I libavcodec/x86/ -o libavcodec/x86/apedsp.o libavcodec/x86/apedsp.asm
  : i686-w64-mingw32-strip -wN '..@*' libavcodec/x86/ac3dsp.o
  : i686-w64-mingw32-strip -wN '..@*' libavcodec/x86/apedsp.o
  : make[1]: Leaving directory '/handbrake/HandBrake/build/contrib/ffmpeg/libav-12.1'
  : ../contrib/ffmpeg/module.rules:2: recipe for target 'contrib/ffmpeg/.stamp.build' failed
  : make: *** [contrib/ffmpeg/.stamp.build] Error 2
Thoughts? What should I try?

User avatar
BradleyS
Moderator
Posts: 1401
Joined: Thu Aug 09, 2007 12:16 pm

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by BradleyS » Wed Jul 19, 2017 6:16 am

Hmm. Something's definitely not right. Here's the general process:

1. Install Ubuntu 16.04.
2. Install dependencies (NOT mingw).
3. Build mingw-w64 using scripts/mingw-w64-build.
4. Add mingw-w64 binaries location to beginning of PATH.
4. Configure HandBrake with --cross=x86_64-w64-mingw32 or --cross=i686-w64-mingw32 and build.

Is it possible you missed any of these? Perhaps you have Ubuntu's mingw installed, and/or didn't add the mingw-w64 binaries to your PATH variable after building with the included script? What's the output of `echo "${PATH}"`?

rboy
Posts: 35
Joined: Sun Jul 09, 2017 12:11 am

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rboy » Wed Jul 19, 2017 6:50 am

Did all of that, built from scratch. finally wrote this script to build handbrake

Code: Select all

#!/usr/bin/env bash

original_path="$PATH"

  echo "Starting 32-bit builds..."
  export PATH="/handbrake/toolchains//mingw-w64-i686/bin:${original_path}"
  cd HandBrake
  ./configure --cross=i686-w64-mingw32 --enable-qsv --launch-jobs=$(nproc) --launch
  cd ..

export PATH="$original_path"
See anything wrong with this?

User avatar
BradleyS
Moderator
Posts: 1401
Joined: Thu Aug 09, 2007 12:16 pm

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by BradleyS » Wed Jul 19, 2017 7:37 am

Double slash after the toolchains directory is a bit odd, have you checked the mingw directory exists there?

Please provide the output of configure. It's in the build directory.

rboy
Posts: 35
Joined: Sun Jul 09, 2017 12:11 am

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rboy » Wed Jul 19, 2017 2:05 pm

Yes I noticed that too but if your followed the instructions on the handbrake page, it says

> scripts/mingw-w64-build x86_64 /home/username/toolchains/

That last slash makes the script output the double slash in the instructions so I followed it exactly.

UPDATE:

The x64 build works perfectly without any issues, only the x86 build isn't working and throws the above error. Exact same script but with i686. I think there may be an issue with the 32bit build on the nightly code.

rboy
Posts: 35
Joined: Sun Jul 09, 2017 12:11 am

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rboy » Wed Jul 19, 2017 3:38 pm

Checked, double checked, the 64bit build works but the 32bit build just won't compile. Can someone just try the 32bit build to confirm that it's not my setup?

Code: Select all

  : yasm -f win32  -DPREFIX -I./ -I./ -Pconfig.asm -I libavcodec/x86/ -M -o libavcodec/x86/apedsp.o libavcodec/x86/apedsp.asm > libavcodec/x86/apedsp.d
  : libavcodec/x86/ac3dsp_init.c: In function 'ac3_downmix_sse':
  : libavcodec/x86/ac3dsp_init.c:72:5: error: 'asm' operand has impossible constraints
  :      __asm__ volatile (                                          \
  :      ^
  : libavcodec/x86/ac3dsp_init.c:156:9: note: in expansion of macro 'MIX5'
  :          MIX5(IF0, IF1);
  :          ^~~~
  : libavcodec/x86/ac3dsp_init.c:72:5: error: 'asm' operand has impossible constraints
  :      __asm__ volatile (                                          \
  :      ^
  : libavcodec/x86/ac3dsp_init.c:160:9: note: in expansion of macro 'MIX5'
  :          MIX5(IF1, IF0);
  :          ^~~~
  : Makefile:48: recipe for target 'libavcodec/x86/ac3dsp_init.o' failed
  : make[1]: *** [libavcodec/x86/ac3dsp_init.o] Error 1
  : make[1]: *** Waiting for unfinished jobs....
  : yasm -f win32  -DPREFIX -I./ -I./ -Pconfig.asm -I libavcodec/x86/ -o libavcodec/x86/apedsp.o libavcodec/x86/apedsp.asm
  : yasm -f win32  -DPREFIX -I./ -I./ -Pconfig.asm -I libavcodec/x86/ -o libavcodec/x86/ac3dsp.o libavcodec/x86/ac3dsp.asm
  : i686-w64-mingw32-strip -wN '..@*' libavcodec/x86/apedsp.o
  : i686-w64-mingw32-strip -wN '..@*' libavcodec/x86/ac3dsp.o
  : make[1]: Leaving directory '/handbrake/HandBrake/build/contrib/ffmpeg/libav-12.1'
  : ../contrib/ffmpeg/module.rules:2: recipe for target 'contrib/ffmpeg/.stamp.build' failed
  : make: *** [contrib/ffmpeg/.stamp.build] Error 2
-------------------------------------------------------------------------------
time end: Wed Jul 19 07:34:16 2017
duration: 15 minutes, 5 seconds (905.80s)
result: FAILURE (code 2)

@s55?

rboy
Posts: 35
Joined: Sun Jul 09, 2017 12:11 am

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rboy » Wed Jul 19, 2017 3:44 pm

What version of ffmpeg is being used with handbrake, I came across this issue on a forum about specific versions of ffmpeg throwing the same error for the same module when compiling for 32bit.

https://mail-index.netbsd.org/pkgsrc-bu ... 54840.html

https://mail-index.netbsd.org/pkgsrc-bu ... 55499.html

rboy
Posts: 35
Joined: Sun Jul 09, 2017 12:11 am

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rboy » Wed Jul 19, 2017 3:53 pm

Is there a way to build handbrake but disable asm optimizations kind of like where ffmpeg has --disable-asm?

rollin_eng
Veteran User
Posts: 2881
Joined: Wed May 04, 2011 11:06 pm

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rollin_eng » Wed Jul 19, 2017 3:59 pm

HB does not use ffmpeg, it uses libav.

rboy
Posts: 35
Joined: Sun Jul 09, 2017 12:11 am

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rboy » Wed Jul 19, 2017 4:24 pm

That was a very productive comment @rollin_eng, like always

Anyways, so some useful information for folks how may be facing the issue and how I resolved it and got the 32bit build working:

Code: Select all

cd HandBrake/contrib/ffmpeg
gedit module.defs
On the first page where you see:

Code: Select all

FFMPEG.CONFIGURE.extra = \
    --enable-gpl \
    --disable-doc \
    ...
Add this line just before --enable-gpl

Code: Select all

    --disable-asm \
So now it looks like

Code: Select all

FFMPEG.CONFIGURE.extra = \
    --disable-asm \
    --enable-gpl \
    --disable-doc \
    ...
Save it and now try to build the 32bit. I used this script:

Code: Select all

#!/usr/bin/env bash

original_path=$PATH

  echo "Starting 32-bit builds..."
  export PATH="/handbrake/toolchains//mingw-w64-i686/bin:${original_path}"
  echo "PATH -> $PATH"
  cd HandBrake
  ./configure --cross=i686-w64-mingw32 --enable-qsv --launch-jobs=$(nproc) --launch
  cd ..

export PATH="$original_path"
As the handbrake team pointed out make sure you've build the i686 version of the toolchain and I used this command to build the toolchain (make sure you've created the /handbrake/toolchains directory before starting this command):

Code: Select all

scripts/mingw-w64-build i686 /handbrake/toolchains/
Ref: https://handbrake.fr/docs/en/latest/dev ... ndows.html

PS - I found the top on this website: https://mattgadient.com/2016/06/20/hand ... nd-how-to/

rollin_eng
Veteran User
Posts: 2881
Joined: Wed May 04, 2011 11:06 pm

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rollin_eng » Wed Jul 19, 2017 4:37 pm

rboy wrote:
Wed Jul 19, 2017 4:24 pm
That was a very productive comment @rollin_eng, like always
rboy wrote:
Wed Jul 19, 2017 3:44 pm
What version of ffmpeg is being used with handbrake,
Sorry, just answering your question.

User avatar
BradleyS
Moderator
Posts: 1401
Joined: Thu Aug 09, 2007 12:16 pm

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by BradleyS » Wed Jul 19, 2017 11:10 pm

Ah, I thought you were building 1.0.7. Will check the nightly here in a bit.

User avatar
BradleyS
Moderator
Posts: 1401
Joined: Thu Aug 09, 2007 12:16 pm

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by BradleyS » Wed Jul 19, 2017 11:55 pm

Okay, so this is definitely an issue with i686 and the nightly. In short, it's running out of registers on i686 in one of the SSE optimizations for the AC3 codec. For whatever reason, Libav thinks it has enough registers to compile that part of code, when it appears to not, and -fomit-frame-pointer isn't enough. Also, we recently updated the mingw build script to use GCC 7.1 (instead of 5.3.x, I think), which may previously have used some magic to abstract away the issue.

If I think of a way to fix this without changing Libav's SSE code to use general constraints, I'll be glad to mention it here and/or commit it. But I don't plan to spend much more time on this.

Anyway, sorry to say this is exactly the type of issue we're not looking to fix now or in the future. Your solution of disabling asm for Libav is the easiest workaround.

rboy
Posts: 35
Joined: Sun Jul 09, 2017 12:11 am

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by rboy » Thu Jul 20, 2017 12:50 am

Thanks for looking into it. If I may ask how much performance impact will disabling ASM have? If you can't find a permanent solution could you update the module.defs file to automatically do an asm disable if compiling for 32 bit that way atleast it will build without having to resort to manual error prone intervention.

User avatar
BradleyS
Moderator
Posts: 1401
Joined: Thu Aug 09, 2007 12:16 pm

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by BradleyS » Thu Jul 20, 2017 1:48 am

Since it's more of a workaround than a true fix, I'd rather not commit that. I realize the irony of leaving it broken, but it is an unsupported configuration at this point.

For the most part, disabling asm opts in Libav means decoding may be slower. Not as much of an impact as say, disabling asm for the x264 encoder. You should be fine.

User avatar
BradleyS
Moderator
Posts: 1401
Joined: Thu Aug 09, 2007 12:16 pm

Re: Handbrake 1.0.7 hangs on QSV encoding

Post by BradleyS » Thu Jul 20, 2017 8:30 am

Slightly better workaround committed as https://github.com/HandBrake/HandBrake/ ... 8cd5099c52

Post Reply