mhogomchungu / media-downloader

Media Downloader is a Qt/C++ front end to yt-dlp, youtube-dl, gallery-dl, lux, you-get, svtplay-dl, aria2c, wget and safari books..
GNU General Public License v2.0
1.6k stars 119 forks source link

How do I compress with options? #301

Closed BarbzYHOOL closed 1 year ago

BarbzYHOOL commented 1 year ago

Hello, on yt-dlp github, i asked how to compress, they gave me this --downloader ffmpeg --downloader-args ffmpeg:-c:v libx264 -crf 30 -preset medium

So I added this as new option

yt-dlp" "--newline" "--ignore-config" "--no-playlist" "-o" "%(title).200s-%(id)s.%(ext)s" "--downloader" "ffmpeg" "--downloader-args" "ffmpeg:-c:v" "libx264" "-crf" "30" "-preset" "medium" "--output-na-placeholder" "NA" "--compat-options" "2022" "--progress-template" "download:[download] {"filename":"%(progress.filename)s","downloaded_bytes":"%(progress.downloaded_bytes)s","ETA":"%(progress.eta)s","total_bytes_estimate":"%(progress.total_bytes_estimate)s","total_bytes":"%(progress.total_bytes)s","speed":"%(progress.speed)s","fragment_index":"%(progress.fragment_index)s","fragment_count":"%(progress.fragment_count)s"}" "https://www.youtube.com/shorts/iYidOv9WL-I"
Usage: yt-dlp [OPTIONS] URL [URL...]
yt-dlp: error: account username missing
[media-downloader] Download Failed(ErrorCode=2)

it doesn't work, i don't know why, can you point it to me?

mhogomchungu commented 1 year ago

Try with below line in the "Download Options" text field.

--downloader ffmpeg --downloader-args "ffmpeg:-c:v libx264 -crf 30 -preset medium"

Space characters in "--downloader-args" option need to be protected with quotes.

BarbzYHOOL commented 1 year ago

Another error now (but i often get error like "download failed" yet the video has been downloaded)

WARNING: [youtube] Cannot parse localized time text "Oct 24, 2022"
[info] IGbbivgPABo: Downloading 1 format(s): 247+251
[download] Destination: Do you have Middle Split genetics? #shorts-IGbbivgPABo.webm
Input #0, matroska,webm, from 'https://rr1---sn-cv0tb0xn-uane.googlevideo.com/videoplayback?expire=1690691294&ei=fpLFZMr4CY-4WsWUiugJ&ip=2001%3A861%3A4140%3A75b0%3A9fcd%3A71f0%3A7820%3Acc28&id=o-AMgdC5SGTcPtqZizpGj_3jCApLq_ioO34xriNym0aI9r&itag=247&source=youtube&requiressl=yes&mh=Xx&mm=31%2C29&mn=sn-cv0tb0xn-uane%2Csn-hgn7rnee&ms=au%2Crdu&mv=m&mvi=1&pl=48&pcm2=no&initcwndbps=1472500&bui=AYlvQAugk3DHqrFBRIn1ENNck4apY8XLbYXg88w_bcyk5guGQL8WoQnHkl09YNzmT-b0FX0V0xJ6O_lQfhDUuVgrO-p6N9MU&vprv=1&svpuc=1&mime=video%2Fwebm&gir=yes&clen=5729343&dur=59.599&lmt=1666630252213421&mt=1690669301&fvip=1&keepalive=yes&fexp=24007246&beids=24350018&c=IOS&txp=543E434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cpcm2%2Cbui%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgC-PDCZduVHdp-cl5v_wU-n3T9GZ55hXQO-_-E_4bc2wCIE1YNLQWNTDYYfEFATAW3dcjy9EtyGFOkMv6_yG2vj2_&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgemVAaE-YGDP-aZOcqwTeBZYlWxnfm8L5a65TTeWvvsACIFRdbX3OQh0oaO1ddn0G73_jo37-i3mQgBXRDaVOeb_f':
  Metadata:
    encoder         : google/video-file
  Duration: 00:00:59.60, start: 0.000000, bitrate: 769 kb/s
  Stream #0:0(eng): Video: vp9 (Profile 0), yuv420p(tv, bt709), 720x1280, SAR 1:1 DAR 9:16, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
Input #1, matroska,webm, from 'https://rr1---sn-cv0tb0xn-uane.googlevideo.com/videoplayback?expire=1690691294&ei=fpLFZMb5FN6Cp-oP36KdqAg&ip=2001%3A861%3A4140%3A75b0%3A9fcd%3A71f0%3A7820%3Acc28&id=o-ABbEYkRBUaSnVX6uLcUr7cIv-yPlK5iObe188BBJDKoT&itag=251&source=youtube&requiressl=yes&mh=Xx&mm=31%2C29&mn=sn-cv0tb0xn-uane%2Csn-hgn7rnee&ms=au%2Crdu&mv=m&mvi=1&pl=48&initcwndbps=1472500&spc=Ul2Sq-u0bUkcZHTzT2GZqrQTQ7soXR4&vprv=1&svpuc=1&mime=audio%2Fwebm&gir=yes&clen=976247&dur=59.621&lmt=1666627706619606&mt=1690669301&fvip=1&keepalive=yes&fexp=24007246%2C24363392&c=ANDROID&txp=5432434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgWs_WHpKaf93HhVhCHVToahIDwEg89DR4H2nskebLq7QCIDbG6ya7KM9QpLON3mPKHvQ2m-ivLA9_XS2DibGPqJDv&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgJwIQKxfSf2wyz_NSSJuPtWsUsHMpJXB2KsM14CmA37wCIQCOTA5QOjzt1uQ92cg7h8J7xlYr9sGCCoIc0HHTjpaDtQ%3D%3D':
  Metadata:
    encoder         : google/video-file
  Duration: 
00:00:59.62, start: -0.007000, bitrate: 130 kb/s
  Stream #1:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 0, only the last option '-c:v libx264' will be used.
Stream mapping:
  Stream #0:0 -> #0:0 (vp9 (native) -> h264 (libx264))
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x55fdff0094c0] using SAR=1/1
[libx264 @ 0x55fdff0094c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA3 BMI1
[libx264 @ 0x55fdff0094c0] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x55fdff0094c0] 264 - core 163 r3060 5db6aa6 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=9 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=30.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[webm @ 0x55fdff0123c0] Only VP8 or VP9 or AV1 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 -- 
Conversion failed!
ERROR: ffmpeg exited with code 1
[media-downloader] Download Failed(ErrorCode=1)

sidenote, we cannot edit an option, we have to remove it and re-add it

mhogomchungu commented 1 year ago

The new error has nothing to do with Media Downloader and i can not help you with it because i have never used ffmpeg to do anything with it.

The error you are getting suggests you are trying to make ffmpeg do something it can not do.

megapro17 commented 1 year ago

You have never used ffmpeg, but you did an gui for media downloaders apps? How this is possible?

mhogomchungu commented 1 year ago

I never experimented with different ffmpeg options and i do not run it manually to convert media from one set of media properties to another set.

All of my use cases is running it with default options and observe its output so that i can properly display them in the GUI.

mhogomchungu commented 1 year ago

Try with below line in the "Download Options" text field.

-f bestvideo[vcodec^=avc]+bestaudio[ext=m4a] --downloader ffmpeg --downloader-args "ffmpeg:-c:v libx264 -crf 30 -preset medium"

Newer versions of yt-dlp seems to prefer vp9 codec and i suspect your current problem is due to this codec and the above line tells yt-dlp to prefer avc codec.

[media-downloader] cmd: "/home/ink/.local/share/media-downloader/bin/yt-dlp" "--match-filter" "!playlist" "--break-on-reject" "--newline" "--ignore-config" "--no-playlist" "-o" "%(title).200s-%(id)s.%(ext)s" "-f" "242+250" "--output-na-placeholder" "NA" "-f" "bestvideo[vcodec^=avc]+bestaudio[ext=m4a]" "--downloader" "ffmpeg" "--downloader-args" "ffmpeg:-c:v libx264 -crf 30 -preset medium" "--compat-options" "2022" "--progress-template" "download:[download] {"filename":"%(progress.filename)s","downloaded_bytes":"%(progress.downloaded_bytes)s","ETA":"%(progress.eta)s","total_bytes_estimate":"%(progress.total_bytes_estimate)s","total_bytes":"%(progress.total_bytes)s","speed":"%(progress.speed)s","fragment_index":"%(progress.fragment_index)s","fragment_count":"%(progress.fragment_count)s"}" "https://www.youtube.com/watch?v=NSrtg6brmpQ"
[youtube] Extracting URL: https://www.youtube.com/watch?v=NSrtg6brmpQ
[youtube] NSrtg6brmpQ: Downloading webpage
[youtube] NSrtg6brmpQ: Downloading ios player API JSON
[youtube] NSrtg6brmpQ: Downloading android player API JSON
[youtube] NSrtg6brmpQ: Downloading m3u8 information
[info] NSrtg6brmpQ: Downloading 1 format(s): 136+140
[download] Destination: SlamBall's Cam Hollins dunks all over defender with between-the-legs jam 💥-NSrtg6brmpQ.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://rr2---sn-8vq5jvhu1-q5gl.googlevideo.com/videoplayback?expire=1690821245&ei=HY7HZMHVBK6evdIPz-2VkA8&ip=197.250.197.32&id=o-AJdlqSJPHkLPVM2Tja4sl_Ih1dA4Hih_aHLoCVqkE8Gz&itag=136&source=youtube&requiressl=yes&mh=ad&mm=31%2C29&mn=sn-8vq5jvhu1-q5gl%2Csn-woc7knel&ms=au%2Crdu&mv=m&mvi=2&pl=24&initcwndbps=132500&vprv=1&svpuc=1&mime=video%2Fmp4&gir=yes&clen=4818587&dur=17.650&lmt=1690761504999452&mt=1690799134&fvip=1&keepalive=yes&fexp=24007246%2C24363393%2C51000014&c=IOS&txp=6309224&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAIqzKj1GGDJ-CLCCY3WFUpmiB8FyT0qYQdt-yPXYCk5QAiEAoWAvIEBUnkL8nIP5iPRWNedSE5PGixVwQRpPPkMaA1w%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgSIA_OErallo0QyWj_9f2ttGjmkDsv1nn0W3zc6psBtoCIE0KcLjIJY5x6FVXAV40w2LgOOTB523A7EhMDVMT5RXe':
  Metadata:
    major_brand     : dash
    minor_version   : 0
    compatible_brands: iso6avc1mp41
    creation_time   : 2023-07-30T23:57:52.000000Z
  Duration: 00:00:17.65, start: 0.000000, bitrate: 
2183 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 620 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      creation_time   : 2023-07-30T23:57:52.000000Z
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'https://rr2---sn-8vq5jvhu1-q5gl.googlevideo.com/videoplayback?expire=1690821245&ei=HY7HZMHVBK6evdIPz-2VkA8&ip=197.250.197.32&id=o-AJdlqSJPHkLPVM2Tja4sl_Ih1dA4Hih_aHLoCVqkE8Gz&itag=140&source=youtube&requiressl=yes&mh=ad&mm=31%2C29&mn=sn-8vq5jvhu1-q5gl%2Csn-woc7knel&ms=au%2Crdu&mv=m&mvi=2&pl=24&initcwndbps=132500&vprv=1&svpuc=1&mime=audio%2Fmp4&gir=yes&clen=287444&dur=17.716&lmt=1690761475152191&mt=1690799134&fvip=1&keepalive=yes&fexp=24007246%2C24363393%2C51000014&c=IOS&txp=6308224&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAOi9vrVzx8A0rXlG7CSGDYl4x15u5wNgXFPEeHL_QtlfAiEA4rUE0XNwYOlkvQwtiWdpv796S_Q0b2mPO4kNpGdA_OI%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgSIA_OErallo0QyWj_9f2ttGjmkDsv1nn0W3zc6psBtoCIE0KcLjIJY5x6FVXAV40w2LgOOTB523A7EhMDVMT5RXe':
  Metadata:
    major_brand     : dash
    minor_version   : 0
    compatible_brands: iso6mp41
    creation_time   : 2023-07-30T23:57:51.000000Z
  Duration: 00:00:17.72, start: 0.000000, bitrate: 129 kb/s
  Stream #1:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 72 kb/s (default)
    Metadata:
      creation_time   : 2023-07-30T23:57:51.000000Z
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 0, only the last option '-c:v libx264' will be used.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x2988a40] using SAR=1/1
[libx264 @ 0x2988a40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x2988a40] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x2988a40] 264 - core 164 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=30.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'file:SlamBall's Cam Hollins dunks all over defender with between-the-legs jam 💥-NSrtg6brmpQ.mp4.part':
  Metadata:
    major_brand     : dash
    minor_version   : 0
    compatible_brands: iso6avc1mp41
    encoder         : Lavf59.27.100
  Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 30k tbn (default)
    Metadata:
      creation_time   : 2023-07-30T23:57:52.000000Z
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.37.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 72 kb/s (default)
    Metadata:
      creation_time   : 2023-07-30T23:57:51.000000Z
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
Frame: 529, Fps: 24, Size: 2928kB
Bitrate: 1353.9kbits/s, Speed: 0.79x, Completed: 100%
video:2632kB audio:277kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.674402%
[libx264 @ 0x2988a40] frame I:6     Avg QP:28.59  size: 27237
[libx264 @ 0x2988a40] frame P:203   Avg QP:31.26  size:  8141
[libx264 @ 0x2988a40] frame B:320   Avg QP:35.85  size:  2744
[libx264 @ 0x2988a40] consecutive B-frames: 12.5% 15.1% 16.4% 56.0%
[libx264 @ 0x2988a40] mb I  I16..4: 28.0% 60.8% 11.2%
[libx264 @ 0x2988a40] mb P  I16..4:  8.5% 11.8%  0.8%  P16..4: 32.5%  5.1%  2.0%  0.0%  0.0%    skip:39.2%
[libx264 @ 0x2988a40] mb B  I16..4:  0.8%  1.2%  0.1%  B16..8: 33.8%  2.4%  0.3%  direct: 0.5%  skip:61.1%  L0:47.4% L1:50.4% BI: 2.2%
[libx264 @ 0x2988a40] 8x8 transform intra:56.7% inter:80.9%
[libx264 @ 0x2988a40] coded y,uvDC,uvAC intra: 25.1% 41.3% 7.9% inter: 4.4% 4.7% 0.1%
[libx264 @ 0x2988a40] i16 v,h,dc,p: 19% 52%  9% 20%
[libx264 @ 0x2988a40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 28% 25%  4%  4%  5%  5%  4%  5%
[libx264 @ 0x2988a40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 32% 17%  4%  6%  5%  6%  5%  3%
[libx264 @ 0x2988a40] i8c dc,h,v,p: 55% 28% 12%  5%
[libx264 @ 0x2988a40] Weighted P-Frames: Y:1.0% UV:0.5%
[libx264 @ 0x2988a40] ref P L0: 72.4% 11.5% 11.5%  4.6%  0.0%
[libx264 @ 0x2988a40] ref B L0: 89.7%  8.7%  1.7%
[libx264 @ 0x2988a40] ref B L1: 97.5%  2.5%
[libx264 @ 0x2988a40] kb/s:1221.02
[download] 2.86 MiB / 2.86 MiB (100%) at 125.50 KiB/s, ETA NA
[media-downloader] Download Completed Successfully
BarbzYHOOL commented 1 year ago

i had tried in the batch window and it worked, it was missing the "-f" i suppose, i'll retry with newer version or come back to this