Answers.Body: <p>Ended up using a batch file to export the timings to a text file and then turncate the value as a set variable.</p>
  
  <pre><code>ffprobe -i {filepath$} -show_entries format=duration -v quiet -of csv="p=0" &gt;&gt; duration.txt
  setlocal enabledelayedexpansion
  for /f "tokens=1,2,3,8 delims=\ " %%a in (duration.txt) do (
    for /f "tokens=1 delims=." %%i in ("%%a") do set _stime=%%i
  )
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-23T01:56:11.583Z
Answers.Text: You've gotta try powershell some time. You won't regret it.
Answers.UserDisplayName: stib
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-22T22:11:16.330Z
Answers.LastActivityDate: 2017-08-22T22:11:16.330Z
Answers.UserDisplayName: Arete
Body: <p>If I use ffprobe to output the duration of a video file with:</p>
  
  <pre><code>ffprobe -i input.mkv -show_entries format=duration -v quiet -of csv="p=0"
  </code></pre>
  
  <p>I will get something like</p>
  
  <pre><code>3658.342000
  </code></pre>
  
  <p>How can I get the output in second only without the decimals? I do not mind if ffmpeg or Mediainfo has a better function for this. I just need to get the output in seconds.</p>
  
  <p><em>I am using CMD in Win10.</em></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-08-20T17:27:49.787Z
Comments.Text: I am unaware of an option within `ffprobe` to do what you want, but you can truncate or round the duration value using your preferred shell or scripting language.
Comments.UserDisplayName: llogan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-08-21T05:22:48.443Z
Comments.Text: With cmd you have to write your own rounding function. https://stackoverflow.com/questions/23116014/batch-rounding-a-number Have you considered using Powershell? Then it's just `[math]::round(x)`. Note that you'll have to extract the number from ffprobe's output somehow.
Comments.UserDisplayName: stib
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-08-22T08:46:57.260Z
Comments.Text: `[math]::round((ffprobe 'input.mkv' -show_entries format=duration -v quiet -of csv="p=0"))` works in powershell. Note the double brackets.
Comments.UserDisplayName: stib
Tags: <ffmpeg>
Title: Echo duration of video in seconds without decimals
UserDisplayName: Arete
ThreadText: # Echo duration of video in seconds without decimals
  
  (Asked by: username_0 on 2017-08-20)
  
  If I use ffprobe to output the duration of a video file with:
  
  ```
  ffprobe -i input.mkv -show_entries format=duration -v quiet -of csv="p=0"
  
  ```
  
  I will get something like
  
  ```
  3658.342000
  
  ```
  
  How can I get the output in second only without the decimals? I do not mind if ffmpeg or Mediainfo has a better function for this. I just need to get the output in seconds.
  
  *I am using CMD in Win10.*
  
  **Tags:** ffmpeg
  
  > **Comments:**
  > **username_1**: I am unaware of an option within `ffprobe` to do what you want, but you can truncate or round the duration value using your preferred shell or scripting language.  
  > **username_2**: With cmd you have to write your own rounding function. https://stackoverflow.com/questions/23116014/batch-rounding-a-number Have you considered using Powershell? Then it's just `[math]::round(x)`. Note that you'll have to extract the number from ffprobe's output somehow.  
  > **username_2**: `[math]::round((ffprobe 'input.mkv' -show_entries format=duration -v quiet -of csv="p=0"))` works in powershell. Note the double brackets.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-08-22. Score: 0 | Accepted answer
  
  Ended up using a batch file to export the timings to a text file and then turncate the value as a set variable.
  
  ```
  ffprobe -i {filepath$} -show_entries format=duration -v quiet -of csv="p=0" >> duration.txt
  setlocal enabledelayedexpansion
  for /f "tokens=1,2,3,8 delims=\ " %%a in (duration.txt) do (
    for /f "tokens=1 delims=." %%i in ("%%a") do set _stime=%%i
  )
  
  ```
  
  > **Comments:**
  > **username_2**: You've gotta try powershell some time. You won't regret it.  
  
  ---
  
  