Page 1 of 1

raspivid -sg option does not work

Posted: Sun Oct 16, 2016 4:20 pm
by olaffit
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

Re: raspivid -sg option does not work

Posted: Sun Oct 16, 2016 8:20 pm
by ethanol100
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,...

Re: raspivid -sg option does not work

Posted: Mon Oct 17, 2016 8:38 am
by olaffit
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

Re: raspivid -sg option does not work

Posted: Mon Oct 17, 2016 10:17 am
by 6by9
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.