olaffit
Posts: 4
Joined: Sun Oct 16, 2016 4:09 pm

raspivid -sg option does not work

Sun Oct 16, 2016 4:20 pm

Hi Guys,
trying to use the -sg segment option, but it does not seem to work. Always creates a file without a segment number at the end and then obviously the following file creates fail.

If I issue

Code: Select all

raspivid --nopreview -v --segment 5000 --start 1 -t 10000 -o test.mpg
I get

Code: Select all

Connecting camera video port to encoder input port
Opening output file "test.mpg"
Enabling encoder output port
Starting video capture
Opening output file "test.mpg"
Failed to open new file "(null)"
Finished capture
Closing down
I have also tried to use the --split option in addition. Looking at the source code of raspivid I do not understand why it does not work.

Code: Select all

if (pState->segmentSize || pState->splitWait)
   {
      // Create a new filename string
      asprintf(&tempname, filename, pState->segmentNumber);
      filename = tempname;
   }
it seems to not enter in this If clause.
Any help would be appreciated. I guess I am doing something stupidly wrong.

Cheers
Olaf

ethanol100
Posts: 583
Joined: Wed Oct 02, 2013 12:28 pm

Re: raspivid -sg option does not work

Sun Oct 16, 2016 8:20 pm

You need to provider a filename containing %d which will then be replaced by a number. I.e. test%d.h264 will create test1.h264, test2.h264,...
If you want a Fixed length with leading zeros you can write %04d which will be replaced by 0001,0002,...

olaffit
Posts: 4
Joined: Sun Oct 16, 2016 4:09 pm

Re: raspivid -sg option does not work

Mon Oct 17, 2016 8:38 am

Great, that works :D . THANKS ethanol100 for the quick help... priceless this forum!!

Just one observation, raspivid still prints out errors, even though the files are created ok.
But who cares, important thing is it works :)

Code: Select all

Starting component connection stage
Connecting camera video port to encoder input port
Opening output file "test1.mpg"
Enabling encoder output port
Starting video capture
Opening output file "test2.mpg"
Failed to open new file "(null)"
Opening output file "test3.mpg"
Failed to open new file "(null)"
Opening output file "test4.mpg"
Failed to open new file "(null)"
Finished capture
Closing down
Close down completed, all components disconnected, disabled and destroyed

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7147
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: raspivid -sg option does not work

Mon Oct 17, 2016 10:17 am

olaffit wrote:Just one observation, raspivid still prints out errors, even though the files are created ok.
But who cares, important thing is it works :)

Code: Select all

Starting component connection stage
Connecting camera video port to encoder input port
Opening output file "test1.mpg"
Enabling encoder output port
Starting video capture
Opening output file "test2.mpg"
Failed to open new file "(null)"
Opening output file "test3.mpg"
Failed to open new file "(null)"
Opening output file "test4.mpg"
Failed to open new file "(null)"
Finished capture
Closing down
Close down completed, all components disconnected, disabled and destroyed
Someone's forgotten to check that inline motion vectors are wanted before trying to open a new segment file for them
https://github.com/raspberrypi/userland ... id.c#L1196
https://github.com/raspberrypi/userland/issues/346 raised, and one of us will fix it when we get a chance. Thanks for the report.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Camera board”