You can use
ffprobe -v quiet -print_format xml -show_format -show_streams inputfile.flv
it will return an xml like this
then filter by the video stream i.e. usually that with attribute index ="0" and get the value of the attribute "duration" which is already in seconds.