• SavvyWolf@pawb.social
    link
    fedilink
    English
    arrow-up
    88
    ·
    2 days ago

    The command it created looks correct, but is subtly wrong. $3 isn’t the “length” of each segment, it’s the template for the output file. $2 is in fact the (approximate) length of each segment in seconds, not the “N” value as the function name suggests. Also, you probably want to set reset_timestamps so the timing information is correct.

    • NEILSON_MANDALA@lemmy.worldOP
      link
      fedilink
      arrow-up
      108
      arrow-down
      4
      ·
      edit-2
      2 days ago

      The command it created looks correct, but is subtly wrong. $3 isn’t the “length” of each segment, it’s the template for the output file. $2 is in fact the (approximate) length of each segment in seconds, not the “N” value as the function name suggests. Also, you probably want to set reset_timestamps so the timing information is correct.

      this is another way to write code without having any idea what you’re doing. just post it on lemmy world as a meme, copypaste a comment that makes the code better along with the original code into the AI agent

        • NEILSON_MANDALA@lemmy.worldOP
          link
          fedilink
          arrow-up
          4
          arrow-down
          6
          ·
          2 days ago

          oh yeah, THAT line…trust me i know a MUCH more damaging one liner than the “remove french” one. it send an email from you to the secret service

          • mech@feddit.org
            link
            fedilink
            arrow-up
            19
            ·
            2 days ago

            How about one that can damage your speakers and your ears, without root access?

            ls -R / | aplay
            
            • emotional_soup_88@programming.dev
              link
              fedilink
              English
              arrow-up
              5
              ·
              2 days ago

              Haven’t checked my low level sound drivers in a long time - I’m using pipewire and wireplumber to control it all. Is ALSA still there at the bottom/as a dependency? Arch btw.

              • mech@feddit.org
                link
                fedilink
                arrow-up
                30
                ·
                edit-2
                2 days ago

                It doesn’t read it out.
                It just feeds the characters directly into your sound driver as raw data, which will play it as a cacophony of noise at max volume, with no regard for your speakers’ frequency limitations.

                • squaresinger@lemmy.world
                  link
                  fedilink
                  arrow-up
                  2
                  ·
                  2 days ago

                  I’d be very surprised if that was able to damage your speakers. If it could, then so could any sound you play. It would have to be an exceptionally bad design if playing a youtube video could destroy your speakers.

              • nocteb@feddit.org
                link
                fedilink
                arrow-up
                5
                ·
                2 days ago

                No it interprets the list of filenames as raw sound data which basically makes random noise maybe with a few bleeps when there are patterns

      • Arthur Besse@lemmy.ml
        link
        fedilink
        English
        arrow-up
        9
        ·
        2 days ago

        just post it on lemmy world as a meme, copypaste a comment that makes the code better along with the original code into the AI agent

        I’m curious if you succeeded with this approach here - have you gotten your LLM to produce a bash function which you can use without needing to understand how to specify an ffmpeg filename pattern yet?

        btw, if want to try learning the old-fashioned way, have a look at man ffmpeg-formats where you can find perhaps-useful information like this:
           segment, stream_segment, ssegment
               Basic stream segmenter.
        
               This  muxer  outputs  streams  to  a number of separate files of nearly
               fixed duration. Output filename pattern can be set in a fashion similar
               to image2, or by using a "strftime" template if the strftime option  is
               enabled.
        
               "stream_segment"  is  a variant of the muxer used to write to streaming
               output formats, i.e. which  do  not  require  global  headers,  and  is
               recommended  for  outputting  e.g.  to  MPEG transport stream segments.
               "ssegment" is a shorter alias for "stream_segment".
        
               Every segment starts with a keyframe of the selected reference  stream,
               which is set through the reference_stream option.
        
               Note  that if you want accurate splitting for a video file, you need to
               make the input key frames  correspond  to  the  exact  splitting  times
               expected  by  the  segmenter,  or  the segment muxer will start the new
               segment with the key frame found next after the specified start time.
        
               The segment muxer works best with a single constant frame rate video.
        
               Optionally it can generate a list of the created segments,  by  setting
               the   option   segment_list.   The   list  type  is  specified  by  the
               segment_list_type option. The entry filenames in the segment  list  are
               set by default to the basename of the corresponding segment files.
        
               See  also  the hls muxer, which provides a more specific implementation
               for HLS segmentation.
        
               Options
        
               The segment muxer supports the following options:
        
        [...]
        

        From the image2 section, here is how the filename pattern works:

                   sequence
                       Select  a  sequence pattern type, used to specify a sequence of
                       files indexed by sequential numbers.
        
                       A sequence pattern may contain the string "%d" or "%0Nd", which
                       specifies  the  position  of  the  characters  representing   a
                       sequential  number  in each filename matched by the pattern. If
                       the form "%d0Nd" is used, the string representing the number in
                       each filename is 0-padded and N is the total number of 0-padded
                       digits representing the number. The literal character  '%'  can
                       be specified in the pattern with the string "%%".
        
                       If  the  sequence  pattern  contains  "%d" or "%0Nd", the first
                       filename of the file list specified by the pattern must contain
                       a  number  inclusively  contained  between   start_number   and
                       start_number+start_number_range-1,   and   all   the  following
                       numbers must be sequential.
        
                       For example the pattern "img-%03d.bmp" will match a sequence of
                       filenames  of   the   form   img-001.bmp,   img-002.bmp,   ...,
                       img-010.bmp,  etc.;  the  pattern "i%%m%%g-%d.jpg" will match a
                       sequence of filenames of  the  form  i%m%g-1.jpg,  i%m%g-2.jpg,
                       ..., i%m%g-10.jpg, etc.
        

        And btw, the ffmpeg-formats manual does also include examples:

               Examples
        
               •   Remux the content of file in.mkv to a list of segments out-000.nut,
                   out-001.nut, etc., and write the  list  of  generated  segments  to
                   out.list:
        
                           ffmpeg -i in.mkv -codec hevc -flags +cgop -g 60 -map 0 -f segment -segment_list out.list out%03d.nut
        
               •   Segment  input  and  set  output  format  options  for  the  output
                   segments:
        
                           ffmpeg -i in.mkv -f segment -segment_time 10 -segment_format_options movflags=+faststart out%03d.mp4
        
               •   Segment the input file according to the split points  specified  by
                   the segment_times option:
        
                           ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.csv -segment_times 1,2,3,5,8,13,21 out%03d.nut
        
               •   Use  the  ffmpeg force_key_frames option to force key frames in the
                   input at the specified location, together with the  segment  option
                   segment_time_delta  to account for possible roundings operated when
                   setting key frame times.
        
                           ffmpeg -i in.mkv -force_key_frames 1,2,3,5,8,13,21 -codec:v mpeg4 -codec:a pcm_s16le -map 0 \
                           -f segment -segment_list out.csv -segment_times 1,2,3,5,8,13,21 -segment_time_delta 0.05 out%03d.nut
        
                   In order to force key frames on  the  input  file,  transcoding  is
                   required.
        
               •   Segment the input file by splitting the input file according to the
                   frame numbers sequence specified with the segment_frames option:
        
                           ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.csv -segment_frames 100,200,300,500,800 out%03d.nut
        
               •   Convert  the  in.mkv  to  TS segments using the "libx264" and "aac"
                   encoders:
        
                           ffmpeg -i in.mkv -map 0 -codec:v libx264 -codec:a aac -f ssegment -segment_list out.list out%03d.ts
        
               •   Segment the input file, and create an M3U8 live  playlist  (can  be
                   used as live HLS source):
        
                           ffmpeg -re -i in.mkv -codec copy -map 0 -f segment -segment_list playlist.m3u8 \
                           -segment_list_flags +live -segment_time 10 out%03d.mkv
        
        

        It is actually possible to figure out how to do this and many other ffmpeg tasks even without internet access :)

        • NEILSON_MANDALA@lemmy.worldOP
          link
          fedilink
          arrow-up
          7
          ·
          2 days ago

          i really need to spend more time reading the mans and less time asking the bot. the mans are guaranteed to be right, but with the bot, who the fuck knows

      • SavvyWolf@pawb.social
        link
        fedilink
        English
        arrow-up
        3
        ·
        2 days ago

        I actually just Googled (well, Kagi’d) it, and found the article that the AI presumably hallucinated this command from.

  • jubilationtcornpone@sh.itjust.works
    link
    fedilink
    arrow-up
    70
    arrow-down
    1
    ·
    edit-2
    2 days ago

    10 minutes later…

    divideMp4IntoNSegmentsOfLengthTButPleaseDoItCorrectlyThisTimePrettyPrettyPleaseJesusFuckWhyAreYouSoFuckingStupid(){
    }
    
      • squaresinger@lemmy.world
        link
        fedilink
        arrow-up
        7
        ·
        2 days ago

        So like

        # Stupid shitty piece of fucking useless waste of compute resources! Do your fucking damn job, you useless clanker!
        
        divideMp4IntoNSegmentsOfLengthT() {
        }
        

        Explicit enough?

        • NEILSON_MANDALA@lemmy.worldOP
          link
          fedilink
          arrow-up
          1
          arrow-down
          1
          ·
          2 days ago

          i think the AI is programmed to tolerate your insults. don’t want an agent that refuses to work with you because it’s robotriggered

        • NEILSON_MANDALA@lemmy.worldOP
          link
          fedilink
          arrow-up
          2
          ·
          2 days ago

          for regex i just use regex playground. but the few times i’ve asked the bot for a regex it got it right…mostly. so yeah, it’s not the only source you want to use

          • Flamekebab@piefed.social
            link
            fedilink
            English
            arrow-up
            4
            ·
            2 days ago

            My experience has been that more complex cases it simply cannot manage. It’ll swear blind that it’s got it right and the result will be super specific to the example provided. If I knew what the strings would be exactly, in advance, I wouldn’t be writing regex 😂

            • NEILSON_MANDALA@lemmy.worldOP
              link
              fedilink
              arrow-up
              1
              ·
              2 days ago

              i’ve seen how ridiculously complicated and unreadable regex can get. i’ve never asked it to make a regex like that, i’ve only had it do simpler ones like “match every word boundary that starts with some character” or whatever

                • NEILSON_MANDALA@lemmy.worldOP
                  link
                  fedilink
                  arrow-up
                  1
                  ·
                  2 days ago

                  well you’re supposed to use it do do things you don’t know how to do. that’s what i do. it’s just that there’s all kinds of shit i don’t know how to do that other people know how to do, and the agent is trained on all that, so it’s helpful (for me, at least)

    • NEILSON_MANDALA@lemmy.worldOP
      link
      fedilink
      arrow-up
      13
      ·
      2 days ago

      it’s a shell function. the code should work for bash or zsh. with those, it doesn’t look like there are any parameters in function definitons, but there are.

  • 6nk06@sh.itjust.works
    link
    fedilink
    arrow-up
    48
    ·
    2 days ago

    I’m pretty sure the awful formatting of the comment is here to trigger us.

    Anyway, merge request rejected for that alone.

  • abbadon420@sh.itjust.works
    link
    fedilink
    arrow-up
    28
    arrow-down
    1
    ·
    2 days ago

    What’s so special about that? It’s basically just googling, but it takes a second instead of an hour. With the added downside that you don’t learn a thing, so you’ll never be able to do it without AI.

    • Eager Eagle@lemmy.world
      link
      fedilink
      English
      arrow-up
      11
      arrow-down
      3
      ·
      edit-2
      2 days ago

      whether you learn something new or not it’s up to you, not the ai

      likewise, you can copy and paste from SO and learn nothing

      • NEILSON_MANDALA@lemmy.worldOP
        link
        fedilink
        arrow-up
        8
        arrow-down
        5
        ·
        2 days ago

        exactly. ppl are like “AI can’t teach you anything” and i’m like “well if you make zero effort to learn, you won’t learn from humans either”

        • Lumidaub@feddit.org
          link
          fedilink
          arrow-up
          9
          arrow-down
          1
          ·
          2 days ago

          See, a teacher will give you a task to solve, preferably on your own, to teach you a thing. They won’t give you a task and the solution so you can look at the solution and go “ah, yes, I understand”.

          • Ethan@programming.dev
            link
            fedilink
            English
            arrow-up
            1
            arrow-down
            1
            ·
            2 days ago

            A good teacher will do that. And even the best teacher can’t force you to learn if you don’t want to. LLMs can be a powerful tool for learning if you’re sufficiently motivated.

            • Lumidaub@feddit.org
              link
              fedilink
              arrow-up
              2
              ·
              2 days ago

              We’re obviously talking about ideal situations because it is impossible in a normal conversation to acknowledge every single aberration. Regardless, if you learn by looking at the solution and going “i understand”, you’re doing yourself a disservice.

      • Shanmugha@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        2 days ago

        Except you are not getting an explanation. Sheesh, do we really need to go all over the “token prediction machine is unable to understand” iteration, again?

        • NEILSON_MANDALA@lemmy.worldOP
          link
          fedilink
          arrow-up
          2
          arrow-down
          1
          ·
          2 days ago

          except you ARE getting an explanation. it doesn’t matter that the AI doesn’t know what it’s doing. do YOU know what you’re doing? do you have any idea how your brain puts words together to form phrases and sentences? of course you don’t

          • Shanmugha@lemmy.world
            link
            fedilink
            arrow-up
            3
            arrow-down
            1
            ·
            edit-2
            2 days ago

            Lol. Once again: I am not getting an explanation, see hallucinated functions and packages (that never happened, right?)

            I know what I am doing, which is exactly why I get paid for my code.

            And we know a lot more about how we think than you imagine, lol. Like, humans do not think in words. But you did not know that, did you?

            • NEILSON_MANDALA@lemmy.worldOP
              link
              fedilink
              arrow-up
              2
              arrow-down
              1
              ·
              2 days ago

              based on your complaints about LLMs, it sounds like you’ve just convinced yourself that anything you code is better than what an LLM would do. you sound like a major narcissist, and i’m going to run my mental health diagnosis bot on your publicly available comment history.

  • Ethan@programming.dev
    link
    fedilink
    English
    arrow-up
    18
    ·
    2 days ago

    Knowing how to write code has only ever been half (or less) of the job. A real programmer solves problems with code, especially problems that aren’t like any they’ve seen before. Someone who can write code but can’t solve problems or can only ‘solve’ problems they’ve seen before is just a code monkey. AI can regurgitate code it’s seen before (that is, code it was trained on) and it can do some problem solving but it falls on its face quickly if you ask it to do anything complex (at least for my metric of what is complex).

    • NEILSON_MANDALA@lemmy.worldOP
      link
      fedilink
      arrow-up
      8
      arrow-down
      3
      ·
      2 days ago

      i want to be clear that AI can’t do your entire job for you, and if you start pushing vibe coded shit to prod, you should start looking for a new job. still, AI is ridiculously useful- maybe not for you, but i’m an amateur with major gaps in my coding knowledge, so AI is incredibly useful for folks like me. of course if i actually get paid to do this shit, every line i write will have to be my own.

      • BassTurd@lemmy.world
        link
        fedilink
        arrow-up
        3
        arrow-down
        1
        ·
        2 days ago

        As a dev that recently transitioned from a decade of sys admin experience, to two years of ServiceNow admin/developer/et all, to now full stack development, I have found AI useful for somethings. I asked it how to do a thing, and it regurgitated a bunch of code that didn’t do what I was looking for, however, it did give me a framework for what files I needed to modify. I then put nose to the grindstone and write all of the rest of the code myself, researching the docs when needed, and I got it done.

        For me, if I use AI to assist in something code, I always type everything out myself whether it’s right or not, because like taking notes, typing it out does help learn what I’m doing, not just finding a solution and running with it. I’ve disabled most of the auto complete copilot garbage in Visual Studio because it would generate huge blocks of code that may or may not be correct, and the accept button is the tab key, which I use frequently. I still have some degree of auto complete for single lines, but that’s it.

        My advice would be to use AI as a prompt to get ideas or steer direction, but if you want to get better at coding and problem solving, I would suggest trying to find solutions yourself because digging through docs will be far more beneficial to your growth. AI does a good job of helping fill the gaps in packages or frameworks when your ignorant to all of the functions and stuff, but striving to understand them instead of relying on unreliable tools will make you a much better developer long term

      • Ethan@programming.dev
        link
        fedilink
        English
        arrow-up
        2
        arrow-down
        1
        ·
        2 days ago

        AI is an extremely useful tool. I’m on the other end of the career track, but it seems to be that it’s almost like having a personal tutor. And as with any other teacher, if you use it as an aid to figure things out yourself I imagine it would help immensely, but at the same time if you use it as a crutch to do your work for you, you skills will be as weak as someone who cheats off their friends in school. I attribute a large part of my skills to spending lots of time reading other people’s code and understanding why they wrote it the way they did (usually because some library didn’t do what I wanted so I figured out how to beat it into submission out of pure stubbornness). If you use the AI as an aid and spend the time to really understand the code it’s producing (and the flaws in that code), I think you’ll build up your skills well.

        My rant about code monkeys was inspired by people I’ve interviewed and worked with who had to be told exactly how to solve a problem since they apparently had zero problem solving skill themselves. The “programming is just writing code” attitude drives me up the fucking wall and “LLMs are going to make programmers obsolete” is just the latest iteration of that bullshit.

        • NEILSON_MANDALA@lemmy.worldOP
          link
          fedilink
          arrow-up
          1
          arrow-down
          1
          ·
          2 days ago

          if i use AI to help me make a full stack app, for example, the learning experience wouldn’t nearly be as good as if i did it all on my own. but when i try to do everything by myself, i get lost and confused as fuck and eventually just abandon it out of frustration and move on to something else. i don’t get paid to do this so i have the luxury of just abandoning shit that gets too frustrating

  • Corbin@programming.dev
    link
    fedilink
    English
    arrow-up
    5
    ·
    2 days ago

    You always need to read what the machine generated for you; the machine can only write code for you, not understand code for you. Here, the biggest issue is that copy might not work if the input and output containers are different, if the input has multiple framerates or audio tracks, etc.

    • NEILSON_MANDALA@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      arrow-down
      2
      ·
      2 days ago

      if that happens- or, in general, whenever the code doesn’t get you what you want- you just copypaste the terminal output back into the AI agent. i know from a good deal of experience that vibe debugging is 100% brainless, and you could train a high schooler to do it

      • Lumidaub@feddit.org
        link
        fedilink
        arrow-up
        1
        ·
        2 days ago

        Why am I getting the word “prototype”? The spirits are saying “prototype”. That mean anything to you?

        • NEILSON_MANDALA@lemmy.worldOP
          link
          fedilink
          arrow-up
          4
          arrow-down
          1
          ·
          2 days ago

          i’ve never heard voices in my head, but there have been several times where i’ve thought in other people’s voices. i’ve never thought in my own voice. i’m schizoaffective so that’s probably why.

          over the years i have throught in the following people’s voices:

          1. stephen hawking

          2. pete davidson

          3. robert evans

          4. dan carlin

          these days it is 100% trevor moore (RIP). whenever i imagine myself doing something i see trevor doing it.