porjo / youtubeuploader

Scripted uploads to Youtube
Apache License 2.0
766 stars 100 forks source link

googleapi: got HTTP response code 408 with body #172

Closed wcbonner closed 1 year ago

wcbonner commented 1 year ago

I know that 408 is a timeout error, so there may not be a body, but I've been trying to figure out what's going on by having a smaller chunksize and that doesn't seem to make a difference.

It would be nice if in debug mode you dumped all the correctly parsed arguments to confirm they were entered correctly.

I've been having problems uploading videos and was hoping that more control via a command line app might at least tell me what the problem is.

wim@WimPi400:~ $ ~/youtubeuploader/youtubeuploader -debug -secrets ~/youtubeuploader/client_secrets.json -cache ~/youtubeuploader/request.token -chunksize 4096 -filename 20230926-Golden-Gardens-Monk-Sinking-2.mkv 
Uploading file "20230926-Golden-Gardens-Monk-Sinking-2.mkv"
[DEBUG] Adding file name to request: "20230926-Golden-Gardens-Monk-Sinking-2.mkv"
[DEBUG] Content-Type header value "application/x-www-form-urlencoded"
[DEBUG] Requesting URL "https://oauth2.googleapis.com/token"
[DEBUG] Content-Type header value "application/json"
[DEBUG] Requesting URL "https://youtube.googleapis.com/upload/youtube/v3/videos?alt=json&notifySubscribers=true&part=snippet&part=status&part=recordingDetails&prettyPrint=false&uploadType=resumable"
[DEBUG] Content-Type header value "video/webm"
[DEBUG] Requesting URL "https://youtube.googleapis.com/upload/youtube/v3/videos?alt=json&notifySubscribers=true&part=snippet&part=status&part=recordingDetails&prettyPrint=false&uploadType=resumable&upload_id=ADPycdsdF00Fsf4zMMWnmZ2QRy496ON6ULmFG0go74tNVxHoAb_bgrVnYGeLoweVMZcx5-uc0-YCm9T0FX4MDgwSRPCOAA"
Progress:    10.92 Mbps, 180224 / 9653885669 (0.0%) ETA 1h57m55s
2023/09/28 08:56:30 Error making YouTube API call: googleapi: got HTTP response code 408 with body: 
wim@WimPi400:~ $ 
porjo commented 1 year ago

MKV files are not in the list of supported formats for Youtube: https://support.google.com/youtube/troubleshooter/2888402?hl=en

You should use MP4 (for h264 encoded video) or WebM (for VP8/9 encoded video). You may be able to convert your MKV to one of those formats without having to completely re-encode your video - see https://stackoverflow.com/a/30954566/202311

wcbonner commented 1 year ago

MKV files are not in the list of supported formats for Youtube: https://support.google.com/youtube/troubleshooter/2888402?hl=en

You should use MP4 (for h264 encoded video) or WebM (for VP8/9 encoded video). You may be able to convert your MKV to one of those formats without having to completely re-encode your video - see https://stackoverflow.com/a/30954566/202311

Interesting. I've been uploading MKV files to YouTube for several years with no problems. I'll use FFmpeg to convert it to an MP4 and see if it makes a difference.

wcbonner commented 1 year ago

MKV files are not in the list of supported formats for Youtube: https://support.google.com/youtube/troubleshooter/2888402?hl=en

You should use MP4 (for h264 encoded video) or WebM (for VP8/9 encoded video). You may be able to convert your MKV to one of those formats without having to completely re-encode your video - see https://stackoverflow.com/a/30954566/202311

Converted to MP4 and got same result.

wim@WimPi400:~ $ ffmpeg -i 20230926-Golden-Gardens-Monk-Sinking-2.mkv -c:v copy -movflags +faststart 20230926-Golden-Gardens-Monk-Sinking-2.mp4
ffmpeg version 4.3.6-0+deb11u1+rpt5 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u1+rpt5 --toolchain=hardened --incdir=/usr/include/aarch64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-mmal --enable-neon --enable-v4l2-request --enable-libudev --enable-epoxy --enable-sand --libdir=/usr/lib/aarch64-linux-gnu --arch=arm64 --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, matroska,webm, from '20230926-Golden-Gardens-Monk-Sinking-2.mkv':
  Metadata:
    ENCODER         : Lavf60.11.100
  Duration: 00:12:26.48, start: 0.000000, bitrate: 103460 kb/s
    Stream #0:0: Video: hevc (Main), yuv420p(tv), 3840x2160, 29.97 fps, 29.97 tbr, 1k tbn, 29 tbc
    Metadata:
      HANDLER_NAME    : VideoHandler
      VENDOR_ID       : [0][0][0][0]
      DURATION        : 00:12:26.479000000
    Stream #0:1: Subtitle: subrip
    Metadata:
      DURATION        : 00:12:26.261000000
Output #0, mp4, to '20230926-Golden-Gardens-Monk-Sinking-2.mp4':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0: Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv), 3840x2160, q=2-31, 29.97 fps, 29.97 tbr, 16k tbn, 1k tbc
    Metadata:
      HANDLER_NAME    : VideoHandler
      VENDOR_ID       : [0][0][0][0]
      DURATION        : 00:12:26.479000000
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x5565843c80] Starting second pass: moving the moov atom to the beginning of the file24x    
frame=22372 fps=119 q=-1.0 Lsize= 9421274kB time=00:12:26.44 bitrate=103395.4kbits/s speed=3.95x    
video:9420944kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.003505%
wim@WimPi400:~ $ ~/youtubeuploader/youtubeuploader -debug -secrets ~/youtubeuploader/client_secrets.json -cache ~/youtubeuploader/request.token -chunksize 1024 -filename 20230926-Golden-Gardens-Monk-Sinking-2.mp4 
Uploading file "20230926-Golden-Gardens-Monk-Sinking-2.mp4"
[DEBUG] Adding file name to request: "20230926-Golden-Gardens-Monk-Sinking-2.mp4"
[DEBUG] Content-Type header value "application/x-www-form-urlencoded"
[DEBUG] Requesting URL "https://oauth2.googleapis.com/token"
[DEBUG] Content-Type header value "application/json"
[DEBUG] Requesting URL "https://youtube.googleapis.com/upload/youtube/v3/videos?alt=json&notifySubscribers=true&part=snippet&part=status&part=recordingDetails&prettyPrint=false&uploadType=resumable"
[DEBUG] Content-Type header value "video/mp4"
[DEBUG] Requesting URL "https://youtube.googleapis.com/upload/youtube/v3/videos?alt=json&notifySubscribers=true&part=snippet&part=status&part=recordingDetails&prettyPrint=false&uploadType=resumable&upload_id=ADPycdsYrLNGVe-9Qn4szXnAa-9tGYWeHnL_gaUmEVJbkiTlW7_er4HiQF5e--QSrr1fPHPKDxLgr9qxZfdHrfTumgPMMVo1Bim_"
Progress:    10.54 Mbps, 81920 / 9647384673 (0.0%) ETA   2h2m3s
2023/09/29 22:24:47 Error making YouTube API call: googleapi: got HTTP response code 408 with body: 
porjo commented 1 year ago

I've been uploading MKV files to YouTube for several years with no problems

I guess it's unofficially supported. I have a vague recollection of some strange timeout issues in the past when using unsupported formats, but on second thoughts you'd expect to see an error with at least a hint that it's file format related.

Converted to MP4 and got same result.

ok, thanks for trying.

Can you try a couple more things please:

wcbonner commented 1 year ago

I've been uploading MKV files to YouTube for several years with no problems

I guess it's unofficially supported. I have a vague recollection of some strange timeout issues in the past when using unsupported formats, but on second thoughts you'd expect to see an error with at least a hint that it's file format related.

Converted to MP4 and got same result.

ok, thanks for trying.

Can you try a couple more things please:

  • ensure you're using the latest youtubeuploader version

  • attempt the mp4 upload again with -quiet flag and no -chunksize

I'll try it again tomorrow. The Pi I was running from has been powered down for the weekend.

Is the -quiet flag the reverse of using the -debug flag, or can I use both?

I should probably mention that I've had some strange upload issues from my normal browser with my current internet provider. Sometimes it works exactly as expected, and sometimes it never makes any progress. I was hoping that a console upload program would give me much more fine grain information on what's happening. Also I could upload from a pi and disconnect my windows machine from the pi and leave the upload running.

porjo commented 1 year ago

Is the -quiet flag the reverse of using the -debug flag, or can I use both?

You can use both. -quiet just suppresses the progress indicator.

I should probably mention that I've had some strange upload issues from my normal browser with my current internet provider. Sometimes it works exactly as expected, and sometimes it never makes any progress.

Hmm, that doesn't sound good. If you're seeing the same/similar issue on a different host and software, then it would suggest an issue with your network or Internet provider... it's little reminiscent of the MTU issues that plagued broadband uplinks that use PPPoE.

wcbonner commented 1 year ago

Is the -quiet flag the reverse of using the -debug flag, or can I use both?

You can use both. -quiet just suppresses the progress indicator.

I should probably mention that I've had some strange upload issues from my normal browser with my current internet provider. Sometimes it works exactly as expected, and sometimes it never makes any progress.

Hmm, that doesn't sound good. If you're seeing the same/similar issue on a different host and software, then it would suggest an issue with your network or Internet provider... it's little reminiscent of the MTU issues that plagued broadband uplinks that use PPPoE.

No change with the quiet option. I'm using T-Mobile Home Internet, and some videos of similar size upload fine, but then some have this problem.

wim@WimPi400:~ $ ~/youtubeuploader/youtubeuploader -debug -secrets ~/youtubeuploader/client_secrets.json -cache ~/youtubeuploader/request.token -quiet -filename 20230926-Golden-Gardens-Monk-Sinking-2.mp4 
Uploading file "20230926-Golden-Gardens-Monk-Sinking-2.mp4"
[DEBUG] Adding file name to request: "20230926-Golden-Gardens-Monk-Sinking-2.mp4"
[DEBUG] Content-Type header value "application/x-www-form-urlencoded"
[DEBUG] Requesting URL "https://oauth2.googleapis.com/token"
[DEBUG] Content-Type header value "application/json"
[DEBUG] Requesting URL "https://youtube.googleapis.com/upload/youtube/v3/videos?alt=json&notifySubscribers=true&part=snippet&part=status&part=recordingDetails&prettyPrint=false&uploadType=resumable"
[DEBUG] Content-Type header value "video/mp4"
[DEBUG] Requesting URL "https://youtube.googleapis.com/upload/youtube/v3/videos?alt=json&notifySubscribers=true&part=snippet&part=status&part=recordingDetails&prettyPrint=false&uploadType=resumable&upload_id=ADPycduXWKhw3wb40B27tI4doigOutY4WR8bTapTpBo87So9JHag5KraYKvwOLV22dXORKHQzRdzdcRNwTTjpHG-TURRDQ"

2023/10/02 19:17:31 Error making YouTube API call: googleapi: got HTTP response code 408 with body: 
wim@WimPi400:~ $ ~/youtubeuploader/youtubeuploader -version
Youtubeuploader version: 23.04
wcbonner commented 1 year ago

I'm going to close this issue. It would be nice if there was some idea why it was happening, but it's no longer a huge priority for me. I was able to start the upload and get to 15% in a coffee shop in the normal browser YouTube interface, cancel it, then resume when I was back at home. It completed overnight.

As a minor feature request, I'd suggest that when the -debug option is used you display the version details in the output. that might simplify further debugging.

porjo commented 1 year ago

As a minor feature request, I'd suggest that when the -debug option is used you display the version details in the output. that might simplify further debugging.

Good suggestion. I've included it in the latest release.