[ffmpeg] NVENC encoding not working
Open
Nobody has claimed this yet.
os:win
- Dominant language
- C
- Stars
- 37k
- Forks
- 3.5k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 22
Description
Important Information
- mpv 0.34.0
- Windows 10 and 11
- Windows build by shinchiro
- stopped working with mpv 0.33.1, worked with 0.33.0
Reproduction steps
mpv 'test.mp4' '--start=0:00:00.000' '--end=0:00:16.855' --loop-file=no --no-pause --ovc=h264_nvenc --oac=aac '--o=./test.mp4-[00.00.000-00.16.855]-audio.mp4' -v --log-file=encode.log
Expected behavior
Succesful encode with NVENC
Actual behavior
Encode failing
Log file
[ 0.078][i][vo/lavc] Opening encoder: NVIDIA NVENC H.264 encoder [h264_nvenc]
[ 0.079][d][ffmpeg] h264_nvenc: Loaded Nvenc version 11.1
[ 0.079][d][ffmpeg] h264_nvenc: Nvenc initialized successfully
[ 0.090][d][ffmpeg] h264_nvenc: 1 CUDA capable devices found
[ 0.090][d][ffmpeg] h264_nvenc: [ GPU #0 - < NVIDIA GeForce RTX 3060 Laptop GPU > has Compute SM 8.6 ]
[ 0.200][d][ffmpeg] h264_nvenc: supports NVENC
[ 0.256][v][ao] Trying audio driver 'lavc'
[ 0.256][v][ao/lavc] requested format: 48000 Hz, stereo channels, floatp
[ 0.256][v][ao/lavc] Channel layouts:
[ 0.256][v][ao/lavc] - anything
[ 0.257][v][ao/lavc] result: stereo
[ 0.257][i][ao/lavc] Opening encoder: AAC (Advanced Audio Coding) [aac]
[ 0.257][i][encode] Opening output file: ./test.mp4-[00.00.000-00.16.855]-audio.mp4
[ 0.258][i][encode] Opening muxer: MP4 (MPEG-4 Part 14) [mp4]
[ 0.258][v][ao/lavc] device buffer: 12288 samples.
[ 0.258][v][ao/lavc] using soft-buffer of 12288 samples.
[ 0.258][i][cplayer] AO: [lavc] 48000Hz stereo 2ch floatp
[ 0.259][v][cplayer] AO: Description: audio encoding using libavcodec
[ 0.260][v][cplayer] first video frame after restart shown
[ 0.260][v][af] [convert] (disabled)
[ 0.260][v][af] [out] 48000Hz stereo 2ch floatp
[ 0.261][v][cplayer] audio ready
[ 0.261][d][cplayer] starting video playback
[ 0.261][v][cplayer] delaying audio start 0.040000 vs. 0.040000, diff=0.000000
[ 0.261][v][cplayer] playback restart complete @ 0.040000, audio=ready, video=playing
[ 0.262][v][cplayer] starting audio playback
[ 0.262][v][ao/lavc] starting AO
[ 0.298][e][ffmpeg] mp4: pts (960) < dts (1917) in stream 0
[ 0.298][e][encode] Writing packet failed.
[ 0.299][v][cplayer] EOF code: 6
[ 0.299][d][ad] Uninit decoder.
[ 0.299][d][vd] Uninit decoder.
[ 0.306][d][cplayer] Terminating demuxers...
[ 0.307][d][cplayer] Done terminating demuxers.
[ 0.307][v][cplayer] finished playback, something happened (reason 4)
[ 0.307][i][cplayer]
[ 0.309][v][ffmpeg] aac: Qavg: 2310.054
[ 0.350][d][ffmpeg] h264_nvenc: Nvenc unloaded
[ 0.350][d][ffmpeg] AVIOContext: Statistics: 64075 bytes written, 0 seeks, 2 writeouts
[ 0.351][i][cplayer] Exiting... (Interrupted by error)
[ 0.351][d][console] Exiting...
[ 0.351][d][stats] Exiting...
[ 0.351][d][ytdl_hook] Exiting...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided mpv command with test.mp4 on the stated Windows setup and inspect encode.log, especially the NVENC and muxer messages. Done means the requested H.264/AAC MP4 encode completes without the “Writing packet failed” error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100