Answers.Body: <p><em>.h264</em> is a raw format. It has no timestamps or metadata storing the input duration. Therefore you need to convert it to mp4 or another suitable format.</p>
  <p>You can mux to MP4 and use that.</p>
  <pre><code>ffmpeg -i xx.h264 -c copy xx.mp4
  
  ffmpeg -sseof -10 -re -i xx.mp4 -c copy -f rtsp rtsp://localhost:8554/mystream
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-01-27T12:35:43.687Z
Answers.Text: Why is it not working with h264?
Answers.UserDisplayName: Aras
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-01-27T14:55:04.753Z
Answers.Text: `.h264` is a raw format. It has no timestamps or metadata storing the input duration.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-01-27T11:38:52.327Z
Answers.LastActivityDate: 2023-02-02T19:04:44.180Z
Answers.LastEditDate: 2023-02-02T19:04:44.180Z
Answers.UserDisplayName: Gyan
Body: <p>I can use ss and sseof parameters with mp4 files and stream the result, but I get errors when I use same commands on h264 file (checked that it also works without seek parameters)</p>
  <p>here are the commands I have:</p>
  <h3>1</h3>
  <pre><code>ffmpeg -re -i xx.h264 -c copy -f rtsp rtsp://localhost:8554/mystream
  </code></pre>
  <p>working fine,</p>
  <h3>2</h3>
  <pre><code>ffmpeg -sseof -10 -re -i xx.h264 -c copy -f rtsp rtsp://localhost:8554/mystream
  </code></pre>
  <p>ignoring sseof parameter</p>
  <p><strong>error message:</strong></p>
  <blockquote>
  <p>Cannot use -sseof, duration of xx.h264 not known</p>
  </blockquote>
  <h3>3</h3>
  <pre><code>xx.h264: could not seek to position -10.000
  </code></pre>
  <p>not working at all</p>
  <p><strong>error message:</strong></p>
  <blockquote>
  <p>xx.h264: could not seek to position -10.000</p>
  </blockquote>
  <p>How can I fix this issue?</p>
  
Tags: <ffmpeg><h.264>
Title: ffmpeg seek position options not working with h264
UserDisplayName: Aras
ThreadText: # ffmpeg seek position options not working with h264
  
  (Asked by: username_0 on 2023-01-27)
  
  I can use ss and sseof parameters with mp4 files and stream the result, but I get errors when I use same commands on h264 file (checked that it also works without seek parameters)
  
  here are the commands I have:
  
  ### 1
  
  ```
  ffmpeg -re -i xx.h264 -c copy -f rtsp rtsp://localhost:8554/mystream
  
  ```
  
  working fine,
  
  ### 2
  
  ```
  ffmpeg -sseof -10 -re -i xx.h264 -c copy -f rtsp rtsp://localhost:8554/mystream
  
  ```
  
  ignoring sseof parameter
  
  **error message:**
  
  > Cannot use -sseof, duration of xx.h264 not known
  
  ### 3
  
  ```
  xx.h264: could not seek to position -10.000
  
  ```
  
  not working at all
  
  **error message:**
  
  > xx.h264: could not seek to position -10.000
  
  How can I fix this issue?
  
  **Tags:** ffmpeg, h.264
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-01-27. Score: 1 | Accepted answer
  
  *.h264* is a raw format. It has no timestamps or metadata storing the input duration. Therefore you need to convert it to mp4 or another suitable format.
  
  You can mux to MP4 and use that.
  
  ```
  ffmpeg -i xx.h264 -c copy xx.mp4
  
  ffmpeg -sseof -10 -re -i xx.mp4 -c copy -f rtsp rtsp://localhost:8554/mystream
  
  ```
  
  > **Comments:**
  > **username_0**: Why is it not working with h264?  
  > **username_1**: `.h264` is a raw format. It has no timestamps or metadata storing the input duration.  
  
  ---
  
  