Body: <p>I use the following command to convert videos recorded by Nvidia ShadowPlay to x265:</p>
  
  <p><code>ffmpeg -i "%fn%.mp4" -c:v libx265 -crf 28 -c:a aac -b:a 128k "%fn%.x265.mp4"</code></p>
  
  <p>I've done this for the past year+ with no problems.  Recently I reinstalled Windows,  flashed my BIOS, and obviously reinstalled ShadowPlay.  Now whenever I run this command against these MP4 files, despite there not being any errors in the console, it creates a corrupt, unplayable file that is dramatically smaller than expected (tried in MPC-HC and MPV).  Files I converted prior to reinstalling still play fine in these players.</p>
  
  <p>I'm sort of at a loss as to what to do without any errors and MPC-HC just says "Cannot render the file", but I don't see how to get any extra information (in a log or whatever).  I grabbed the latest ffmpeg (4.2.1) as I was using 4.1.3 before this, but it made no difference.</p>
  
  <p>Any ideas?  Are there other easy to use command line x265 converters?</p>
  
  <p>Here's the output of converting a 10gb file.  I'm using the <code>-ss</code> switch as I have in the past, but it does the same even without it.</p>
  
  <pre><code>C:\Users\langdonx\Videos&gt;set fn=s11w3oct31-nov6
  
  C:\Users\langdonx\Videos&gt;ffmpeg -i "s11w3oct31-nov6.mp4" -ss 5:04 -c:v libx265 -crf 28 -c:a aac -b:a 128k "s11w3oct31-nov6.x265.mp4"
  ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
    built with gcc 8.3.1 (GCC) 20190414
    configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
    libavutil      56. 22.100 / 56. 22.100
    libavcodec     58. 35.100 / 58. 35.100
    libavformat    58. 20.100 / 58. 20.100
    libavdevice    58.  5.100 / 58.  5.100
    libavfilter     7. 40.101 /  7. 40.101
    libswscale      5.  3.100 /  5.  3.100
    libswresample   3.  3.100 /  3.  3.100
    libpostproc    55.  3.100 / 55.  3.100
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 's11w3oct31-nov6.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf58.12.100
    Duration: 00:24:09.32, start: 0.000000, bitrate: 57968 kb/s
      Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 57764 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 196 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
  Stream mapping:
    Stream #0:0 -&gt; #0:0 (h264 (native) -&gt; hevc (libx265))
    Stream #0:1 -&gt; #0:1 (aac (native) -&gt; aac (native))
  Press [q] to stop, [?] for help
  x265 [info]: HEVC encoder version 3.0_Au+21-bac0e1acb874
  x265 [info]: build info [Windows][GCC 8.3.1][64 bit] 8bit+10bit
  x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
  x265 [info]: Main profile, Level-4 (Main tier)
  x265 [info]: Thread pool created using 12 threads
  x265 [info]: Slices                              : 1
  x265 [info]: frame threads / pool features       : 3 / wpp(17 rows)
  x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
  x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
  x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
  x265 [info]: Keyframe min / max / scenecut / bias: 25 / 250 / 40 / 5.00
  x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
  x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
  x265 [info]: References / ref-limit  cu / depth  : 3 / on / on
  x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
  x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
  x265 [info]: tools: rd=3 psy-rd=2.00 rskip signhide tmvp strong-intra-smoothing
  x265 [info]: tools: lslices=6 deblock sao
  Output #0, mp4, to 's11w3oct31-nov6.x265.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf58.20.100
      Stream #0:0(und): Video: hevc (libx265) (hev1 / 0x31766568), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 30k tbn, 29.97 tbc (default)
      Metadata:
        handler_name    : VideoHandler
        encoder         : Lavc58.35.100 libx265
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        encoder         : Lavc58.35.100 aac
  frame= 7634 fps= 17 q=-0.0 size=  183296kB time=00:04:15.07 bitrate=5886.8kbits/s speed=0.579x
  C:\Users\langdonx\Videos&gt;echo.
  
  
  C:\Users\langdonx\Videos&gt;echo COMPLETE!
  COMPLETE!
  
  C:\Users\langdonx\Videos&gt;pause
  Press any key to continue . . .
  </code></pre>
  
  <p>ffplay output:</p>
  
  <pre><code>ffplay sw.x265.mp4
  ffplay version 4.2.1 Copyright (c) 2003-2019 the FFmpeg developers
    built with gcc 9.1.1 (GCC) 20190807
    configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
    libavutil      56. 31.100 / 56. 31.100
    libavcodec     58. 54.100 / 58. 54.100
    libavformat    58. 29.100 / 58. 29.100
    libavdevice    58.  8.100 / 58.  8.100
    libavfilter     7. 57.100 /  7. 57.100
    libswscale      5.  5.100 /  5.  5.100
    libswresample   3.  5.100 /  3.  5.100
    libpostproc    55.  5.100 / 55.  5.100
  [mov,mp4,m4a,3gp,3g2,mj2 @ 0000019655161240] moov atom not found0
  sw.x265.mp4: Invalid data found when processing input
  </code></pre>
  
  <p>mpv output:</p>
  
  <pre><code>C:\Users\langdonx\Downloads\mpv-x86_64-20191215-git-2dbe33c&gt;mpv sw.x265.mp4
  [ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: moov atom not found
  [lavf] avformat_open_input() failed
  [ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: moov atom not found
  [lavf] avformat_open_input() failed
  Failed to recognize file format.
  </code></pre>
  
  <p>Why would ffmpeg create these broken files but not report anything in the output?  Do I need to enable some hardware feature in my BIOS?  ffmpeg itself supports the AAC codec I'm using right, or do I need to install one somehow?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-21T15:41:56.503Z
Comments.Text: Does ffplay it? What's the log of mpv?
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-21T16:34:28.390Z
Comments.Text: @Gyan Didn't even think to try ffplay... I added ffplay and mpv output to the bottom of my question.
Comments.UserDisplayName: Langdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-21T17:11:17.430Z
Comments.Text: Does `ffmpeg -i in -c copy out.mp4` produce a playable file?
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-21T17:20:24.210Z
Comments.Text: Yes, with the same length and size as the original.
Comments.UserDisplayName: Langdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-21T17:49:15.740Z
Comments.Text: Since it takes so long to convert something and end up in a failure state, I've taken my smallest file (6:32 @ 2.48gb) and I'm running some isolated tests against it. I cropped it down to 2 minutes with `-copy` and when I convert that, it produces a playable file.  Using `-ss 0:00 -to 0:30` also produces a playable file.  I'll see if I can figure out which conditions fail.
Comments.UserDisplayName: Langdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-21T20:43:25.153Z
Comments.Text: It seems to fail at random... I did the first 4m30s and it worked... and every a few further tests, returned to do another 4m30s test and it failed.  Maybe I need to run memtest?
Comments.UserDisplayName: Langdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-22T01:58:21.120Z
Comments.Text: @Gyan I changed the output container from mp4 to mkv and ran my 4m30s test again... the file is playable but it's only 2:02 long...
Comments.UserDisplayName: Langdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-22T05:08:12.697Z
Comments.Text: Yes, I suspect a HW failure mode.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-22T16:23:44.823Z
Comments.Text: I'll run memtest, but mkv is seemingly working 100% without fail now.  Are there certain requirements for mp4 (memory, disk, etc) that mkv output doesn't need?
Comments.UserDisplayName: Langdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-22T16:48:17.800Z
Comments.Text: Not really; main difference is ffmpeg writes the MP4 metadata after all the media data is written.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-22T21:46:09.697Z
Comments.Text: Ah, makes sense.  I've converted 8 or so files, all of the mkv files are playable (I guess, obviously), but some are shorter than the original.  It looks like ffmpeg is dying somewhere along the way but not throwing any errors in the console.  Trying to glean some information from changing the loglevel.  Still need to make a bootable thumbdrive with memtest86.
Comments.UserDisplayName: Langdon
Tags: <ffmpeg>
Title: FFMPEG fails to convert to usable x265 MP4 after reinstalling Windows/flashing BIOS
UserDisplayName: Langdon
ThreadText: # FFMPEG fails to convert to usable x265 MP4 after reinstalling Windows/flashing BIOS
  
  (Asked by: username_0 on 2019-12-21)
  
  I use the following command to convert videos recorded by Nvidia ShadowPlay to x265:
  
  `ffmpeg -i "%fn%.mp4" -c:v libx265 -crf 28 -c:a aac -b:a 128k "%fn%.x265.mp4"`
  
  I've done this for the past year+ with no problems. Recently I reinstalled Windows, flashed my BIOS, and obviously reinstalled ShadowPlay. Now whenever I run this command against these MP4 files, despite there not being any errors in the console, it creates a corrupt, unplayable file that is dramatically smaller than expected (tried in MPC-HC and MPV). Files I converted prior to reinstalling still play fine in these players.
  
  I'm sort of at a loss as to what to do without any errors and MPC-HC just says "Cannot render the file", but I don't see how to get any extra information (in a log or whatever). I grabbed the latest ffmpeg (4.2.1) as I was using 4.1.3 before this, but it made no difference.
  
  Any ideas? Are there other easy to use command line x265 converters?
  
  Here's the output of converting a 10gb file. I'm using the `-ss` switch as I have in the past, but it does the same even without it.
  
  ```
  C:\Users\langdonx\Videos>set fn=s11w3oct31-nov6
  
  C:\Users\langdonx\Videos>ffmpeg -i "s11w3oct31-nov6.mp4" -ss 5:04 -c:v libx265 -crf 28 -c:a aac -b:a 128k "s11w3oct31-nov6.x265.mp4"
  ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
    built with gcc 8.3.1 (GCC) 20190414
    configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
    libavutil      56. 22.100 / 56. 22.100
    libavcodec     58. 35.100 / 58. 35.100
    libavformat    58. 20.100 / 58. 20.100
    libavdevice    58.  5.100 / 58.  5.100
    libavfilter     7. 40.101 /  7. 40.101
    libswscale      5.  3.100 /  5.  3.100
    libswresample   3.  3.100 /  3.  3.100
    libpostproc    55.  3.100 / 55.  3.100
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 's11w3oct31-nov6.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf58.12.100
    Duration: 00:24:09.32, start: 0.000000, bitrate: 57968 kb/s
      Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 57764 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 196 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
  Stream mapping:
    Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
    Stream #0:1 -> #0:1 (aac (native) -> aac (native))
  Press [q] to stop, [?] for help
  x265 [info]: HEVC encoder version 3.0_Au+21-bac0e1acb874
  x265 [info]: build info [Windows][GCC 8.3.1][64 bit] 8bit+10bit
  x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
  x265 [info]: Main profile, Level-4 (Main tier)
  x265 [info]: Thread pool created using 12 threads
  x265 [info]: Slices                              : 1
  x265 [info]: frame threads / pool features       : 3 / wpp(17 rows)
  x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
  x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
  x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
  x265 [info]: Keyframe min / max / scenecut / bias: 25 / 250 / 40 / 5.00
  x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
  x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
  x265 [info]: References / ref-limit  cu / depth  : 3 / on / on
  x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
  x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
  x265 [info]: tools: rd=3 psy-rd=2.00 rskip signhide tmvp strong-intra-smoothing
  x265 [info]: tools: lslices=6 deblock sao
  Output #0, mp4, to 's11w3oct31-nov6.x265.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf58.20.100
      Stream #0:0(und): Video: hevc (libx265) (hev1 / 0x31766568), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 30k tbn, 29.97 tbc (default)
      Metadata:
        handler_name    : VideoHandler
        encoder         : Lavc58.35.100 libx265
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        encoder         : Lavc58.35.100 aac
  frame= 7634 fps= 17 q=-0.0 size=  183296kB time=00:04:15.07 bitrate=5886.8kbits/s speed=0.579x
  C:\Users\langdonx\Videos>echo.
  
  C:\Users\langdonx\Videos>echo COMPLETE!
  COMPLETE!
  
  C:\Users\langdonx\Videos>pause
  Press any key to continue . . .
  
  ```
  
  ffplay output:
  
  ```
  ffplay sw.x265.mp4
  ffplay version 4.2.1 Copyright (c) 2003-2019 the FFmpeg developers
    built with gcc 9.1.1 (GCC) 20190807
    configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
    libavutil      56. 31.100 / 56. 31.100
    libavcodec     58. 54.100 / 58. 54.100
    libavformat    58. 29.100 / 58. 29.100
    libavdevice    58.  8.100 / 58.  8.100
    libavfilter     7. 57.100 /  7. 57.100
    libswscale      5.  5.100 /  5.  5.100
    libswresample   3.  5.100 /  3.  5.100
    libpostproc    55.  5.100 / 55.  5.100
  [mov,mp4,m4a,3gp,3g2,mj2 @ 0000019655161240] moov atom not found0
  sw.x265.mp4: Invalid data found when processing input
  
  ```
  
  mpv output:
  
  ```
  C:\Users\langdonx\Downloads\mpv-x86_64-20191215-git-2dbe33c>mpv sw.x265.mp4
  [ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: moov atom not found
  [lavf] avformat_open_input() failed
  [ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: moov atom not found
  [lavf] avformat_open_input() failed
  Failed to recognize file format.
  
  ```
  
  Why would ffmpeg create these broken files but not report anything in the output? Do I need to enable some hardware feature in my BIOS? ffmpeg itself supports the AAC codec I'm using right, or do I need to install one somehow?
  
  **Tags:** ffmpeg
  
  > **Comments:**
  > **username_1**: Does ffplay it? What's the log of mpv?  
  > **username_0**: @username_1 Didn't even think to try ffplay... I added ffplay and mpv output to the bottom of my question.  
  > **username_1**: Does `ffmpeg -i in -c copy out.mp4` produce a playable file?  
  > **username_0**: Yes, with the same length and size as the original.  
  > **username_0**: Since it takes so long to convert something and end up in a failure state, I've taken my smallest file (6:32 @ 2.48gb) and I'm running some isolated tests against it. I cropped it down to 2 minutes with `-copy` and when I convert that, it produces a playable file.  Using `-ss 0:00 -to 0:30` also produces a playable file.  I'll see if I can figure out which conditions fail.  
  > **username_0**: It seems to fail at random... I did the first 4m30s and it worked... and every a few further tests, returned to do another 4m30s test and it failed.  Maybe I need to run memtest?  
  > **username_0**: @username_1 I changed the output container from mp4 to mkv and ran my 4m30s test again... the file is playable but it's only 2:02 long...  
  > **username_1**: Yes, I suspect a HW failure mode.  
  > **username_0**: I'll run memtest, but mkv is seemingly working 100% without fail now.  Are there certain requirements for mp4 (memory, disk, etc) that mkv output doesn't need?  
  > **username_1**: Not really; main difference is ffmpeg writes the MP4 metadata after all the media data is written.  
  > **username_0**: Ah, makes sense.  I've converted 8 or so files, all of the mkv files are playable (I guess, obviously), but some are shorter than the original.  It looks like ffmpeg is dying somewhere along the way but not throwing any errors in the console.  Trying to glean some information from changing the loglevel.  Still need to make a bootable thumbdrive with memtest86.  
  
  ---
  
  ## 0 answers
  
  